class_docstr: Runs arbitrary function as an interface
  
  Examples
  --------
  
  >>> func = 'def func(arg1, arg2=5): return arg1 + arg2'
  >>> fi = Function(input_names=['arg1', 'arg2'], output_names=['out'])
  >>> fi.inputs.function_str = func
  >>> res = fi.run(arg1=1)
  >>> res.outputs.out
  6
code: def _set_function_string(self, obj, name, old, new):
      if name == "function_str":
          if hasattr(new, "__call__"):
              function_source = getsource(new)
              fninfo = new.__code__
          elif isinstance(new, (str, bytes)):
              function_source = new
              fninfo = create_function_from_source(
                  new, self.imports
              ).__code__
          self.inputs.trait_set(
              trait_change_notify=False,
              **{"%s" % name: function_source},
          )
          # Update input traits
          input_names = fninfo.co_varnames[: fninfo.co_argcount]
          new_names = set(input_names) - set(self._input_names)
          add_traits(self.inputs, list(new_names))
          self._input_names.extend(new_names)
  
file_path: nipype/nipype/interfaces/utility/wrappers.py
imports: from ...None import logging
  from ..base import traits, DynamicTraitedSpec, Undefined, isdefined, BaseInterfaceInputSpec
  from ..io import IOBase, add_traits
  from ...utils.filemanip import ensure_list
  from ...utils.functions import getsource, create_function_from_source
label_desc: Use image node_id 2 for calling the Function obj's underlying member method code with example usage: obj._set_function_string(obj, name, old, new) without return types