'Send data over the stream.
Sends the given C{obj} over the connection. C{obj} may be instances of
L{domish.Element}, C{unicode} and C{str}. The first two will be
properly serialized and/or encoded. C{str} objects must be in UTF-8
encoding.
Note: because it is easy to make mistakes in maintaining a properly
encoded C{str} object, it is advised to use C{unicode} objects
everywhere when dealing with XML Streams.
@param obj: Object to be sent over the stream.
@type obj: L{domish.Element}, L{domish} or C{str}'

def send(self, obj):

    if domish.IElement.providedBy(obj):
        obj = obj.toXml()
    if isinstance(obj, unicode):
        obj = obj.encode('utf-8')
    if self.rawDataOutFn:
        self.rawDataOutFn(obj)
    self.transport.write(obj)
