docstr: Open (and automatically) close an HTML element
docstr_tok: ["Open","(","and","automatically",")","close","an","HTML","element"]
code: def element(self, name, attrs={}, only_with_attrs=False):
      """Open (and automatically) close an HTML element"""
      if only_with_attrs and not attrs:
          yield
          return
  
      attrs_str = " ".join(
          f"{name}='{value}'" for name, value in attrs.items()
      )
      if attrs_str:
          attrs_str = " " + attrs_str
  
      self.add(f"<{name}{attrs_str}>")
      self.indent_level += 1
      initial_len = len(self.html)
      try:
          yield
      finally:
          self.indent_level -= 1
          closing = f"</{name}>"
          self.add(f"</{name}>", one_line=len(self.html) == initial_len)
  
imports: import abc
  import argparse
  import contextlib
  import difflib
  import enum
  import glob
  import itertools
  import json
  import nbformat
  import os.path
  import re
  import subprocess
  import sys
  import textwrap
label_desc: Use image node_id 3 for calling the HtmlBuilder obj's underlying member method code with example usage: obj.element(name, attrs, only_with_attrs) without return types