code: def write(self, outfile, encoding):
          
          try:
              handler = EscapeFriendlyXMLGenerator(outfile, encoding, short_empty_elements=True)
          except TypeError:  # Python 2
              handler = EscapeFriendlyXMLGenerator(outfile, encoding)
          handler.startDocument()
          handler.startElement('rss', self.rss_attributes())
          handler.startElement('channel', self.root_attributes())
          self.add_root_elements(handler)
          self.write_items(handler)
          self.endChannelElement(handler)
          handler.endElement('rss')
docs: Method override to create self-closing elements.
  
          https://docs.djangoproject.com/en/2.0/ref/utils/#django.utils.feedgenerator.SyndicationFeed.write
          https://github.com/django/django/blob/2.0/django/utils/feedgenerator.py#L216