code: def process(
      frame: FrameType,
      child: object | None,
      state: dict[str, Any],
      *,
      stop: str | None = None,
      omit: Collection[str] = (),
      depth: int | None = None,
  ) -> dict[str, Any] | None:
      """Add counts from a frame stack onto existing state
  
      This recursively adds counts to the existing state dictionary and creates
      new entries for new functions.
  
      Parameters
      ----------
      frame:
          The frame to process onto the state
      child:
          For internal use only
      state:
          The profile state to accumulate this frame onto, see ``create``
      stop:
          Filename suffix that should stop processing if we encounter it
      omit:
          Filenames that we should omit from processing
      depth:
          For internal use only, how deep we are in the call stack
          Used to prevent stack overflow
  
      Examples
      --------
      >>> import sys, threading
      >>> ident = threading.get_ident()  # replace with your thread of interest
      >>> frame = sys._current_frames()[ident]
      >>> state = create()
      >>> process(frame, None, state)
      >>> state
      {'count': 1,
       'identifier': 'root',
       'description': 'root',
       'children': {'...'}}
  
      See also
      --------
      create
      merge
      """
      if depth is None:
          # Cut off rather conservatively since the output of the profiling
          # sometimes need to be recursed into as well, e.g. for serialization
          # which can cause recursion errors later on since this can generate
          # deeply nested dictionaries
          depth = min(100, sys.getrecursionlimit() // 4)
  
      if any(frame.f_code.co_filename.endswith(o) for o in omit):
          return None
  
      prev = frame.f_back
      if (
          depth > 0
          and prev is not None
          and (
              stop is None or not prev.f_code.co_filename.endswith(stop)
          )
      ):
          new_state = process(
              prev, frame, state, stop=stop, depth=depth - 1
          )
          if new_state is None:
              return None
          state = new_state
  
      ident = identifier(frame)
  
      try:
          d = state["children"][ident]
      except KeyError:
          d = {
              "count": 0,
              "description": info_frame(frame),
              "children": {},
              "identifier": ident,
          }
          state["children"][ident] = d
  
      state["count"] += 1
  
      if child is not None:
          return d
      else:
          d["count"] += 1
          return None
  
imports: from __future__ import annotations
  import bisect
  import dis
  import linecache
  import sys
  import threading
  from collections import defaultdict, deque
  from collections.abc import Callable, Collection
  from time import sleep
  from types import FrameType
  from typing import Any
  import tlz
  import dask.config
  from dask.typing import NoDefault, no_default
  from dask.utils import format_time, parse_timedelta
  from distributed.metrics import time
  from distributed.utils import color_of
label_desc: Use image node_id 5 for calling a global function with example usage: process(frame, child, state) and returns: None, d, None, None