code: def pop(
      x: Union[FrozenDict, Dict[str, Any]], key: str
  ) -> Tuple[Union[FrozenDict, Dict[str, Any]], Any]:
      """Create a new dict where one entry is removed. This is a utility
      function that can act on either a FrozenDict or regular dict and
      mimics the behavior of ``FrozenDict.pop``.
  
      Example::
  
        >>> from flax.core import FrozenDict, pop
        >>> variables = FrozenDict({'params': {...}, 'batch_stats': {...}})
        >>> new_variables, params = pop(variables, 'params')
  
      Args:
        x: the dictionary to remove the entry from
        key: the key to remove from the dict
      Returns:
        A pair with the new dict and the removed value.
      """
  
      if isinstance(x, FrozenDict):
          return x.pop(key)
      elif isinstance(x, dict):
          new_dict = jax.tree_map(
              lambda x: x, x
          )  # make a deep copy of dict x
          value = new_dict.pop(key)
          return new_dict, value
      raise TypeError(f"Expected FrozenDict or dict, got {type(x)}")
  
imports: import collections
  from types import MappingProxyType
  from typing import Any, Dict, Hashable, Mapping, Tuple, TypeVar, Union
  import jax
  from flax import serialization
label_desc: Use image node_id 6 for calling a global function with example usage: pop(x, key) and returns: x, new_dict,  value