code: def writeXML(self, n):
          
          self.stream.write(TYPE_XMLSTRING)
          ref = self.context.getObjectReference(n)
  
          if ref != -1:
              self._writeInteger(ref << 1)
  
              return
  
          self.context.addObject(n)
  
          self.serialiseString(xml.tostring(n).encode('utf-8'))
docs: Writes a XML string to the data stream.
  
          @type   n: L{ET<xml.ET>}
          @param  n: The XML Document to be encoded to the AMF3 data stream.