'Utility function to load messages from a file-like object to a queue'

def load_from_file(self, fp, sep='\n'):

    n = 0
    body = ''
    l = fp.readline()
    while l:
        if (l == sep):
            m = Message(self, body)
            self.write(m)
            n += 1
            print ('writing    message    %d' % n)
            body = ''
        else:
            body = (body + l)
        l = fp.readline()
    return n
