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