code: def _format(
      self,
      obj,
      stream,
      indent,
      allowance,
      context,
      level,
      *args,
      **kwargs,
  ):
      if isinstance(obj, Struct):
          rep = self._repr(obj, context, level)
          max_width = self._width - indent - allowance
          if len(rep) <= max_width:
              stream.write(rep)
              return
  
          stream.write("Struct(")
          indent += len("Struct(")
          if all(k.isidentifier() for k in obj):
              n = len(obj.items())
              for i, (k, v) in enumerate(obj.items()):
                  is_first = i == 0
                  is_last = i == n - 1
  
                  if not is_first:
                      stream.write(" " * indent)
                  stream.write(k)
                  stream.write("=")
                  this_indent = indent + len(k) + len("=")
                  self._format(
                      v,
                      stream,
                      this_indent,
                      allowance,
                      context,
                      level,
                      *args,
                      **kwargs,
                  )
                  if not is_last:
                      stream.write(",\n")
          else:
              stream.write("**{")
              indent += len("**{")
              n = len(obj.items())
              for i, (k, v) in enumerate(obj.items()):
                  is_first = i == 0
                  is_last = i == n - 1
  
                  if not is_first:
                      stream.write(" " * indent)
                  stream.write(repr(k))
                  stream.write(": ")
                  this_indent = indent + len(repr(k)) + len(": ")
                  self._format(
                      v,
                      stream,
                      this_indent,
                      allowance,
                      context,
                      level,
                      *args,
                      **kwargs,
                  )
                  if not is_last:
                      stream.write(",\n")
              stream.write("}")
          stream.write(")")
      else:
          _old_printer._format(
              self,
              obj,
              stream,
              indent,
              allowance,
              context,
              level,
              *args,
              **kwargs,
          )
  
imports: from typing import Dict, Any
  from collections import OrderedDict
  from collections.abc import Mapping
  import pprint
  from hail.utils.misc import get_nice_attr_error, get_nice_field_error
  from hail.typecheck import typecheck, typecheck_method, anytype
label_desc: Use image node_id 1 for calling the StructPrettyPrinter obj's underlying member method code with example usage: obj._format(obj, stream, indent, allowance, context, level) without return types