code: def _astuple_inner(obj, tuple_factory):
      if _is_dataclass_instance(obj):
          result = []
          for f in fields(obj):
              value = _astuple_inner(
                  getattr(obj, f.name), tuple_factory
              )
              result.append(value)
          return tuple_factory(result)
      elif isinstance(obj, tuple) and hasattr(obj, "_fields"):
          # obj is a namedtuple.  Recurse into it, but the returned
          # object is another namedtuple of the same type.  This is
          # similar to how other list- or tuple-derived classes are
          # treated (see below), but we just need to create them
          # differently because a namedtuple's __init__ needs to be
          # called differently (see bpo-34363).
          return type(obj)(
              *[_astuple_inner(v, tuple_factory) for v in obj]
          )
      elif isinstance(obj, (list, tuple)):
          # Assume we can create an object of this type by passing in a
          # generator (which is not true for namedtuples, handled
          # above).
          return type(obj)(
              _astuple_inner(v, tuple_factory) for v in obj
          )
      elif isinstance(obj, dict):
          return type(obj)(
              (
                  _astuple_inner(k, tuple_factory),
                  _astuple_inner(v, tuple_factory),
              )
              for k, v in obj.items()
          )
      else:
          return copy.deepcopy(obj)
  
imports: import re
  import sys
  import copy
  import types
  import inspect
  import keyword
  import builtins
  import functools
  import itertools
  import abc
  import _thread
  from types import FunctionType, GenericAlias
label_desc: Use image node_id 36 for calling a global function with example usage: _astuple_inner(obj, tuple_factory) and returns: tuple_factory, type, type, type, copy