code: def _imp_namespace(expr, namespace=None):
      """Return namespace dict with function implementations
  
      We need to search for functions in anything that can be thrown at
      us - that is - anything that could be passed as ``expr``.  Examples
      include SymPy expressions, as well as tuples, lists and dicts that may
      contain SymPy expressions.
  
      Parameters
      ----------
      expr : object
         Something passed to lambdify, that will generate valid code from
         ``str(expr)``.
      namespace : None or mapping
         Namespace to fill.  None results in new empty dict
  
      Returns
      -------
      namespace : dict
         dict with keys of implemented function names within ``expr`` and
         corresponding values being the numerical implementation of
         function
  
      Examples
      ========
  
      >>> from sympy.abc import x
      >>> from sympy.utilities.lambdify import implemented_function, _imp_namespace
      >>> from sympy import Function
      >>> f = implemented_function(Function('f'), lambda x: x+1)
      >>> g = implemented_function(Function('g'), lambda x: x*10)
      >>> namespace = _imp_namespace(f(g(x)))
      >>> sorted(namespace.keys())
      ['f', 'g']
      """
      # Delayed import to avoid circular imports
      from sympy.core.function import FunctionClass
  
      if namespace is None:
          namespace = {}
      # tuples, lists, dicts are valid expressions
      if is_sequence(expr):
          for arg in expr:
              _imp_namespace(arg, namespace)
          return namespace
      elif isinstance(expr, dict):
          for key, val in expr.items():
              # functions can be in dictionary keys
              _imp_namespace(key, namespace)
              _imp_namespace(val, namespace)
          return namespace
      # SymPy expressions may be Functions themselves
      func = getattr(expr, "func", None)
      if isinstance(func, FunctionClass):
          imp = getattr(func, "_imp_", None)
          if imp is not None:
              name = expr.func.__name__
              if name in namespace and namespace[name] != imp:
                  raise ValueError(
                      "We found more than one "
                      "implementation with name "
                      '"%s"' % name
                  )
              namespace[name] = imp
      # and / or they may take Functions as arguments
      if hasattr(expr, "args"):
          for arg in expr.args:
              _imp_namespace(arg, namespace)
      return namespace
  
imports: from __future__ import annotations
  from typing import Any
  import builtins
  import inspect
  import keyword
  import textwrap
  import linecache
  from sympy.external import import_module
  from sympy.utilities.exceptions import sympy_deprecation_warning
  from sympy.utilities.decorator import doctest_depends_on
  from sympy.utilities.iterables import is_sequence, iterable, NotIterable, flatten
  from sympy.utilities.misc import filldedent
label_desc: Use image node_id 7 for calling a global function with example usage: _imp_namespace(expr, namespace) and returns: namespace, namespace, namespace