code: def _generate_translators(to):
      class Translator(ast.NodeTransformer):
          def _visit(self, node):
              if isinstance(node, ast.AST):
                  return self.visit(node)
              elif isinstance(node, list):
                  return [self._visit(n) for n in node]
              else:
                  return node
  
          def generic_visit(self, node):
              cls = type(node).__name__
              try:
                  new_node = getattr(to, cls)()
              except AttributeError:
                  # handle nodes that are not part of the AST
                  return
  
              for field in node._fields:
                  setattr(
                      new_node, field, self._visit(getattr(node, field))
                  )
  
              for attr in node._attributes:
                  try:
                      setattr(new_node, attr, getattr(node, attr))
                  except AttributeError:
                      pass
              return new_node
  
      return Translator
  
label_desc: Use image node_id 1 for calling a global function with example usage: _generate_translators(to) and returns: Translator, new_node, self, unknown, node