code: def parse(self, stream, media_type=None, parser_context=None):
          
          assert etree, 'XMLParser requires defusedxml to be installed'
  
          parser_context = parser_context or {}
          encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET)
          parser = etree.DefusedXMLParser(encoding=encoding)
          try:
              tree = etree.parse(stream, parser=parser, forbid_dtd=True)
          except (etree.ParseError, ValueError) as exc:
              raise ParseError('XML parse error - %s' % six.text_type(exc))
          data = self._xml_convert(tree.getroot())
  
          return data
docs: Parses the incoming bytestream as XML and returns the resulting data.