code: def generate_code(self, name: str, code: types.CodeType) -> str:
      global next_code_version
      # The ordering here matches PyCode_NewWithPosOnlyArgs()
      # (but see below).
      co_consts = self.generate(name + "_consts", code.co_consts)
      co_names = self.generate(name + "_names", code.co_names)
      co_filename = self.generate(name + "_filename", code.co_filename)
      co_name = self.generate(name + "_name", code.co_name)
      co_qualname = self.generate(name + "_qualname", code.co_qualname)
      co_linetable = self.generate(
          name + "_linetable", code.co_linetable
      )
      co_exceptiontable = self.generate(
          name + "_exceptiontable", code.co_exceptiontable
      )
      # These fields are not directly accessible
      localsplusnames, localspluskinds = get_localsplus(code)
      co_localsplusnames = self.generate(
          name + "_localsplusnames", localsplusnames
      )
      co_localspluskinds = self.generate(
          name + "_localspluskinds", localspluskinds
      )
      # Derived values
      nlocals, ncellvars, nfreevars = get_localsplus_counts(
          code, localsplusnames, localspluskinds
      )
      co_code_adaptive = make_string_literal(code.co_code)
      self.write("static")
      with self.indent():
          self.write(f"struct _PyCode_DEF({len(code.co_code)})")
      with self.block(f"{name} =", ";"):
          self.object_var_head("PyCode_Type", len(code.co_code) // 2)
          # But the ordering here must match that in cpython/code.h
          # (which is a pain because we tend to reorder those for perf)
          # otherwise MSVC doesn't like it.
          self.write(f".co_consts = {co_consts},")
          self.write(f".co_names = {co_names},")
          self.write(f".co_exceptiontable = {co_exceptiontable},")
          self.field(code, "co_flags")
          self.field(code, "co_argcount")
          self.field(code, "co_posonlyargcount")
          self.field(code, "co_kwonlyargcount")
          # The following should remain in sync with _PyFrame_NumSlotsForCodeObject
          self.write(
              f".co_framesize = {code.co_stacksize + len(localsplusnames)} + FRAME_SPECIALS_SIZE,"
          )
          self.field(code, "co_stacksize")
          self.field(code, "co_firstlineno")
          self.write(f".co_nlocalsplus = {len(localsplusnames)},")
          self.field(code, "co_nlocals")
          self.write(f".co_ncellvars = {ncellvars},")
          self.write(f".co_nfreevars = {nfreevars},")
          self.write(f".co_version = {next_code_version},")
          next_code_version += 1
          self.write(f".co_localsplusnames = {co_localsplusnames},")
          self.write(f".co_localspluskinds = {co_localspluskinds},")
          self.write(f".co_filename = {co_filename},")
          self.write(f".co_name = {co_name},")
          self.write(f".co_qualname = {co_qualname},")
          self.write(f".co_linetable = {co_linetable},")
          self.write(f"._co_cached = NULL,")
          self.write(f".co_code_adaptive = {co_code_adaptive},")
          first_traceable = 0
          for op in code.co_code[::2]:
              if op == RESUME:
                  break
              first_traceable += 1
          self.write(f"._co_firsttraceable = {first_traceable},")
      name_as_code = f"(PyCodeObject *)&{name}"
      self.finis.append(f"_PyStaticCode_Fini({name_as_code});")
      self.inits.append(f"_PyStaticCode_Init({name_as_code})")
      return f"& {name}.ob_base.ob_base"
  
imports: import argparse
  import builtins
  import collections
  import contextlib
  import os
  import re
  import time
  import types
  from typing import Dict, FrozenSet, TextIO, Tuple
  import umarshal
label_desc: Use image node_id 11 for calling the Printer obj's underlying member method code with example usage: obj.generate_code(name, code) and returns: str, name, str