docstr: Traverses the (func, args) tree of an expression and creates a SymPy
  namespace. All other modules are imported only as a module name. That way
  the namespace is not polluted and rests quite small. It probably causes much
  more variable lookups and so it takes more time, but there are no tests on
  that for the moment.
docstr_tok: ["Traverses","the","(","func",",","args",")","tree","of","an","expression","and","creates","a","SymPy","namespace",".","All","other","modules","are","imported","only","as","a","module","name",".","That","way","the","namespace","is","not","polluted","and","rests","quite","small",".","It","probably","causes","much","more","variable","lookups","and","so","it","takes","more","time",",","but","there","are","no","tests","on","that","for","the","moment","."]
code: def sympy_expression_namespace(cls, expr):
      """Traverses the (func, args) tree of an expression and creates a SymPy
      namespace. All other modules are imported only as a module name. That way
      the namespace is not polluted and rests quite small. It probably causes much
      more variable lookups and so it takes more time, but there are no tests on
      that for the moment."""
      if expr is None:
          return {}
      else:
          funcname = str(expr.func)
          # XXX Workaround
          # Here we add an ugly workaround because str(func(x))
          # is not always the same as str(func). Eg
          # >>> str(Integral(x))
          # "Integral(x)"
          # >>> str(Integral)
          # "<class 'sympy.integrals.integrals.Integral'>"
          # >>> str(sqrt(x))
          # "sqrt(x)"
          # >>> str(sqrt)
          # "<function sqrt at 0x3d92de8>"
          # >>> str(sin(x))
          # "sin(x)"
          # >>> str(sin)
          # "sin"
          # Either one of those can be used but not all at the same time.
          # The code considers the sin example as the right one.
          regexlist = [
              r"<class \'sympy[\w.]*?.([\w]*)\'>$",
              # the example Integral
              r"<function ([\w]*) at 0x[\w]*>$",  # the example sqrt
          ]
          for r in regexlist:
              m = re.match(r, funcname)
              if m is not None:
                  funcname = m.groups()[0]
          # End of the workaround
          # XXX debug: print funcname
          args_dict = {}
          for a in expr.args:
              if isinstance(a, (Symbol, NumberSymbol)) or a in [
                  I,
                  zoo,
                  oo,
              ]:
                  continue
              else:
                  args_dict.update(cls.sympy_expression_namespace(a))
          args_dict.update({funcname: expr.func})
          return args_dict
  
imports: import re
  from sympy.core.numbers import I, NumberSymbol, oo, zoo
  from sympy.core.symbol import Symbol
  from sympy.utilities.iterables import numbered_symbols
  from sympy.external import import_module
  import warnings
label_desc: Use image node_id 10 for calling the Lambdifier obj's underlying member method code with example usage: obj.sympy_expression_namespace(cls, expr) and returns: dict, args_dict