docs: def _display(node, indent, expandattrs, expandvals, output):
      """Core function to display a Node object"""
      attrs = _displayattrs(node.attrib, expandattrs)
      if node.text is None or not expandvals:
          val = ''
      elif isinstance(node.text, str):
          val = ' %s' % repr(node.text.strip())
      else:
          val = ' %s' % repr(node.text)  # node.text can be a tuple
      output.write(encode(indent + striptag(node.tag) + attrs + val + '\n'))
      for sub_node in node:
          _display(sub_node, indent + '  ', expandattrs, expandvals, output)