create logging file of data on gateway umts

I am new to the xbee gateway and to python. I have six devices that send data to a coordinator. The coordinator then sends the data to the gateway as it is received. I send about 10 bytes of data separated by commas from the coordinator to the gateway using the zigbee transmit request command. I can see the data in the datastream but cannot access them. I would like the data to simply go to a csv file that is appended to. I have been able to update the python code to create a file on my gateway called YNOT.CSV but I do not know the code that would direct data into the file. Does anybody have a hint or an example that could help me? Although I have found the xbee radios easy to work with, this gateway is very cryptic to me and I have not found a lot of help. If more information is needed I am more than willing to provide it.