code: def fork(
      self,
      _default: Pattern
      | dict[filterlib.Filter, Pattern]
      | Missing = MISSING,
      **patterns: Pattern,
  ) -> (
      dict[str, RngStream]
      | tuple[dict[str, RngStream], dict[str, RngStream]]
  ):
      if not self.is_valid():
          raise errors.TraceContextError(
              "Cannot use Rngs from a different trace level"
          )
  
      filter_patterns: list[tuple[filterlib.Filter, Pattern]]
      if isinstance(_default, dict):
          # merge default and patterns
          filter_patterns = [
              *_default.items(),
              *patterns.items(),
              (..., None),  # broadcast all remaining
          ]
      else:
          default = None if isinstance(_default, Missing) else _default
          filter_patterns = [
              *patterns.items(),
              (..., default),  # split all remaining with default
          ]
  
      predicate_pattern = [
          (filterlib.to_predicate(filter_), pattern)
          for filter_, pattern in filter_patterns
      ]
  
      splits: dict[str, RngStream] = {}
      broadcasts: dict[str, RngStream] = {}
  
      for name, stream in self._rngs.items():
          for predicate, pattern in predicate_pattern:
              if predicate(name, stream):
                  fork = stream.fork(pattern)
                  if pattern is None:
                      broadcasts[name] = fork
                  else:
                      splits[name] = fork
                  break
          else:
              raise RuntimeError(
                  f"Strea {name!r} did not match any predicate, this is a bug."
              )
  
      if isinstance(_default, dict) or patterns:
          return splits, broadcasts
      else:
          return {**splits, **broadcasts}
  
imports: from __future__ import annotations
  import dataclasses
  import hashlib
  import typing
  import jax
  import numpy
  from flax.experimental.nnx.nnx import errors, filterlib, tracers
label_desc: Use image node_id 15 for calling the Rngs obj's underlying member method code with example usage: obj.fork(_default) and returns: splits,  broadcasts, dict