code: def standardize_arguments(
      args: tuple | Any, process_fn: Callable | None = None
  ) -> tuple[tuple, dict]:
      """
      Standardize the arguments to standard Python arguments.
  
      Following the pracitce of ``torch.onnx.export``, it accepts three types of arguments and forms them into
      a tuple of positional arguments and a dictionary of keyword arguments:
  
      1. a tuple of arguments: ``(x, y, z)``
      2. a tensor: ``torch.Tensor([1])``
      3. a tuple of arguments ending with a dictionary of named arguments: ``(x, {"y": input_y, "z": input_z})``
  
      Parameters
      ----------
      args
          The arguments to standardize.
      process_fn
          A function to process the arguments.
  
      Returns
      -------
      The standard arguments, positional arguments and keyword arguments.
      """
  
      if not isinstance(args, tuple):
          args, kwargs = (args,), {}
      elif not args:
          args, kwargs = (), {}
      elif isinstance(args[-1], dict):
          args, kwargs = args[:-1], args[-1]
      else:
          args, kwargs = args, {}
  
      from torch.utils._pytree import tree_map
  
      args = tree_map(process_fn, args) if process_fn else args
      kwargs = tree_map(process_fn, kwargs) if process_fn else kwargs
      return args, kwargs
  
file_path: nni/nni/nas/profiler/pytorch/utils/misc.py
imports: from __future__ import annotations
  from typing import Any, Callable, TypeVar, Type
  from torch import nn
  from nni.nas.nn.pytorch import ParametrizedModule
label_desc: Use image node_id 2 for calling a global function with example usage: standardize_arguments(args, process_fn) and returns: args,  kwargs