code: def internal_state(*, params=True) -> InternalState:
      frame = base.current_frame()
      rng = frame.rng_stack.peek()
      if rng is not None:
          rng = rng.internal_state
      return InternalState(
          params=(copy_structure(frame.params) if params else None),
          state=copy_structure(frame.state),
          rng=copy_structure(rng),
      )
  
imports: import collections
  import collections.abc
  from collections.abc import Mapping, MutableMapping
  import functools
  import inspect
  from typing import Any, Callable, Optional, TypeVar
  from haiku._src import base
  import jax
  import jax.numpy
label_desc: Use image node_id 2 for calling a global function with example usage: internal_state() and returns: InternalState