code: def sig_remove_state(s: inspect.Signature) -> inspect.Signature:
      """Remove hk.State from the return type of a signature."""
      ret = s.return_annotation
      # Extract the tuple element types from `typing._GenericAlias` or
      # `types.GenericAlias`.
      ret_generic = getattr(ret, "__origin__", None)
      ret_type_args = getattr(ret, "__args__", ())
      if ret_generic is tuple and len(ret_type_args) == 2:
          ret = ret_type_args[0]
      else:
          ret = Any
      return inspect.Signature(
          parameters=list(s.parameters.values()),
          return_annotation=ret,
          __validate_parameters__=False,
      )
  
imports: from collections.abc import Mapping
  import inspect
  from typing import Any, Callable, NamedTuple, Optional, TypeVar, Union
  from haiku._src import analytics
  from haiku._src import base
  from haiku._src import data_structures
  from haiku._src import typing
  import jax
label_desc: Use image node_id 2 for calling a global function with example usage: sig_remove_state(s) and returns: inspect