code: def infer_argnums_and_argnames(
      sig: inspect.Signature,
      argnums: int | Iterable[int] | None,
      argnames: str | Iterable[str] | None,
  ) -> tuple[tuple[int, ...], tuple[str, ...]]:
      """Infer missing argnums and argnames for a function with inspect."""
      if argnums is None and argnames is None:
          return (), ()
  
      if argnums is not None and argnames is not None:
          argnums = _ensure_index_tuple(argnums)
          argnames = _ensure_str_tuple(argnames)
          return argnums, argnames
  
      parameters = sig.parameters
      if argnums is None:
          assert argnames is not None
          argnames = _ensure_str_tuple(argnames)
          argnums = tuple(
              i
              for i, (k, param) in enumerate(parameters.items())
              if param.kind == _POSITIONAL_OR_KEYWORD and k in argnames
          )
      else:
          argnums = _ensure_index_tuple(argnums)
          argnames = tuple(
              k
              for i, (k, param) in enumerate(parameters.items())
              if param.kind == _POSITIONAL_OR_KEYWORD and i in argnums
          )
  
      return argnums, argnames
  
imports: from __future__ import annotations
  from collections.abc import Iterable, Sequence
  import inspect
  import operator
  from functools import partial
  from typing import Any, Callable
  import warnings
  import numpy
  from jax._src import core
  from jax._src import dtypes
  from jax._src.abstract_arrays import numpy_scalar_types
  from jax._src.core import ShapedArray
  from jax._src.tree_util import PyTreeDef, tree_flatten, tree_unflatten, tree_map, tree_structure, treedef_children, generate_key_paths, keystr, broadcast_prefix, prefix_errors
  from jax._src.tree_util import _replace_nones
  from jax._src import linear_util
  from jax._src.linear_util import TracingDebugInfo
  from jax._src.util import safe_map, WrapKwArgs, Hashable, HashableFunction, Unhashable
  from jax._src import traceback_util
label_desc: Use image node_id 26 for calling a global function with example usage: infer_argnums_and_argnames(sig, argnums, argnames) and returns: argnums,  argnames, ,  , argnums,  argnames