code: def _get_init_args(
      frame: types.FrameType,
  ) -> Tuple[Optional[Any], Dict[str, Any]]:
      _, _, _, local_vars = inspect.getargvalues(frame)
      if "__class__" not in local_vars:
          return None, {}
      cls = local_vars["__class__"]
      init_parameters = inspect.signature(cls.__init__).parameters
      self_var, args_var, kwargs_var = parse_class_init_keys(cls)
      filtered_vars = [n for n in (self_var, args_var, kwargs_var) if n]
      exclude_argnames = (
          *filtered_vars,
          "__class__",
          "frame",
          "frame_args",
      )
      # only collect variables that appear in the signature
      local_args = {k: local_vars[k] for k in init_parameters}
      # kwargs_var might be None => raised an error by mypy
      if kwargs_var:
          local_args.update(local_args.get(kwargs_var, {}))
      local_args = {
          k: v
          for k, v in local_args.items()
          if k not in exclude_argnames
      }
      self_arg = local_vars.get(self_var, None)
      return self_arg, local_args
  
imports: import copy
  import inspect
  import pickle
  import types
  from dataclasses import fields, is_dataclass
  from typing import Any, Dict, List, Literal, MutableMapping, Optional, Sequence, Tuple, Type, Union
  from torch import nn
  import lightning.pytorch
  from lightning.fabric.utilities.data import AttributeDict
  from lightning.pytorch.utilities.rank_zero import rank_zero_warn
label_desc: Use image node_id 5 for calling a global function with example usage: _get_init_args(frame) and returns: self_arg,  local_args, None,  dict