write out module to file descriptor.
        fd -- file descriptor to write out service description.
        msg_fd -- optional file descriptor for messages module.

def write(self, fd, msg_fd=None):
        """write out module to file descriptor.
        fd -- file descriptor to write out service description.
        msg_fd -- optional file descriptor for messages module.
        """
#        if msg_fd != None:
#            print >>fd, self.messagesImports
#            print >>msg_fd, self.imports
#        else:
        print >>fd, self.imports
            
        print >>fd, self.locator
        for m in self.bindings:
            print >>fd, m

#        if msg_fd != None:
#            for m in self.messages:
#                print >>msg_fd, m
#        else:
        for m in self.messages:
            print >>fd, m