code: def add_options(parser=None, module=None, function=None):
      interface = None
      if parser and module and function:
          __import__(module)
          interface = getattr(sys.modules[module], function)()
  
          inputs = interface.input_spec()
          for name, spec in sorted(
              interface.inputs.traits(transient=None).items()
          ):
              desc = "\n".join(get_trait_desc(inputs, name, spec))[
                  len(name) + 2 :
              ]
              args = {}
  
              if spec.is_trait_type(traits.Bool):
                  args["action"] = "store_true"
  
              if hasattr(spec, "mandatory") and spec.mandatory:
                  if spec.is_trait_type(InputMultiPath):
                      args["nargs"] = "+"
                  parser.add_argument(name, help=desc, **args)
              else:
                  if spec.is_trait_type(InputMultiPath):
                      args["nargs"] = "*"
                  parser.add_argument(
                      "--%s" % name, dest=name, help=desc, **args
                  )
      return parser, interface
  
file_path: nipype/nipype/utils/nipype_cmd.py
imports: import os
  import argparse
  import inspect
  import sys
  from ..interfaces.base import Interface, InputMultiPath, traits
  from ..interfaces.base.support import get_trait_desc
  from .misc import str2bool
label_desc: Use image node_id 2 for calling a global function with example usage: add_options(parser, module, function) and returns: parser,  interface