code: def parse_args(kwargs, defaults=None):
      """Apply command line arguments or show help.
  
      Use this in conjunction with the fire library to quickly build
      command line interfaces for your scripts.
  
      This function returns another function that must be called with
      the estimator (e.g. ``NeuralNet``) to apply the parsed command
      line arguments. If the --help option is found, show the
      estimator-specific help instead.
  
      Examples
      --------
      Content of my_script.py:
  
      >>> def main(**kwargs):
      >>>     X, y = get_data()
      >>>     my_model = get_model()
      >>>     parsed = parse_args(kwargs)
      >>>     my_model = parsed(my_model)
      >>>     my_model.fit(X, y)
      >>>
      >>> if __name__ == '__main__':
      >>>     fire.Fire(main)
  
  
      Note
      ----
      The function you pass to `fire.Fire` shouldn't have any positional
      arguments, otherwise the displayed help will not correctly work;
      this is a quirk of fire.
  
      Parameters
      ----------
      kwargs : dict
        The arguments as parsed by fire.
  
      defaults : dict or None (default=None)
        Optionally, change the default values to use custom
        defaults. Commandline arguments have precedence over defaults.
  
      Returns
      -------
      print_help_and_exit : callable
        If --help is in the arguments, print help and exit.
  
      set_params : callable
        If --help is not in the options, apply command line arguments to
        the estimator and return it.
  
      """
      try:
          import fire  # pylint: disable=unused-import
      except ImportError:
          raise ImportError(
              "Using skorch cli helpers requires the fire library,"
              " you can install it with pip: python -m pip install fire."
          )
      try:
          import numpydoc.docscrape  # pylint: disable=unused-import
      except ImportError:
          raise ImportError(
              "Using skorch cli helpers requires the numpydoc library,"
              " you can install it with pip: python -m pip install numpydoc."
          )
  
      defaults = defaults or {}
  
      def print_help_and_exit(estimator):
          print_help(estimator, defaults=defaults)
          sys.exit()
  
      def set_params(estimator):
          estimator.set_params(**defaults)
          return estimator.set_params(**parse_net_kwargs(kwargs))
  
      if kwargs.get("help"):
          return print_help_and_exit
      return set_params
  
imports: from functools import partial
  from importlib import import_module
  from itertools import chain
  import re
  import shlex
  import sys
  from sklearn.base import BaseEstimator
  from sklearn.pipeline import FeatureUnion
  from sklearn.pipeline import Pipeline
label_desc: Use image node_id 14 for calling a global function with example usage: parse_args(kwargs, defaults) and returns: set_params, estimator, print_help_and_exit