docs: def _write(self, text):
          """Write text by respecting the current indentlevel"""
          spaces = ' ' * (self.indent * self.indentlevel)
          t = spaces + text.strip() + '\n'
          if hasattr(t, 'encode'):
              t = t.encode(self.encoding, 'xmlcharrefreplace')
          self.stream.write(t)