Scripting a Controller for KX_NetworkMessageSensor

I recently scripted a controller to handle a KX_NetworkMessageSensor, and it works, but it also produces a python warning message on every call. I have scoured the net for python tutorials but cant seem to find a solution. Can someone who knows python better than myself please assist?

Here I am calling on the attached sensor to retrieve the messsage bodies, which the API says returns a list value. However when I try to iterate over this list with the foreach loop, I get a python warning.

messageList = sensor.getBodies()
for message in messageList:

“TypeError: iteration over non-sequence”