code: def _parse_arguments_by_section(
      parents,
      section,
      args_from_config_file,
      args_from_cmd,
      required_section,
  ):
      """
      This function first adds parameter names to a parser,
      according to the section name.
      Then it loads values from configuration files as tentative params.
      Finally it overrides existing pairs of 'name, value' with commandline
      inputs.
  
      Commandline inputs only override system/custom parameters.
      input data related parameters needs to be defined in config file.
  
      :param parents: a list, parsers will be created as
          subparsers of parents
      :param section: section name to be parsed
      :param args_from_config_file: loaded parameters from config file
      :param args_from_cmd: dictionary commandline parameters
      :return: parsed parameters of the section and unknown
          commandline params.
      """
      section_parser = argparse.ArgumentParser(
          parents=parents,
          description=__doc__,
          formatter_class=argparse.RawDescriptionHelpFormatter,
      )
  
      try:
          add_args_func = SUPPORTED_DEFAULT_SECTIONS[section]
      except KeyError:
          if section == required_section:
  
              def add_args_func(parser):
                  """
                  wrapper around add_customised_args
                  """
                  return add_customised_args(parser, section.upper())
  
          else:
              # all remaining sections are defaulting to input section
              add_args_func = add_input_data_args
  
      section_parser = add_args_func(section_parser)
  
      # loading all parameters a config file first
      if args_from_config_file is not None:
          section_parser.set_defaults(**args_from_config_file)
      # input command line input overrides config file
      if (section in SYSTEM_SECTIONS) or (section == required_section):
          section_args, unknown = section_parser.parse_known_args(
              args_from_cmd
          )
          return section_args, unknown
      # don't parse user cmd for input source sections
      section_args, _ = section_parser.parse_known_args([])
      return section_args, args_from_cmd
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import argparse
  import os
  import textwrap
  from niftynet.engine.signal import TRAIN, INFER, EVAL
  from niftynet.utilities.util_common import look_up_operations
  from niftynet.engine.application_factory import ApplicationFactory
  from niftynet.engine.application_factory import SUPPORTED_APP
  from niftynet.io.misc_io import resolve_file_name
  from niftynet.utilities.niftynet_global_config import NiftyNetGlobalConfig
  from niftynet.utilities import NiftyNetLaunchConfig
  from niftynet.utilities.user_parameters_custom import SUPPORTED_ARG_SECTIONS
  from niftynet.utilities.user_parameters_custom import add_customised_args
  from niftynet.utilities.user_parameters_default import SUPPORTED_DEFAULT_SECTIONS
  from niftynet.utilities.user_parameters_default import add_input_data_args
  from niftynet.utilities.user_parameters_helper import has_section_in_config
  from niftynet.utilities.user_parameters_helper import standardise_section_name
  from niftynet.utilities.util_common import damerau_levenshtein_distance
  from niftynet.utilities.versioning import get_niftynet_version_string
label_desc: Use image node_id 3 for calling a global function with example usage: _parse_arguments_by_section(parents, section, args_from_config_file, args_from_cmd, required_section) and returns: section_args,  args_from_cmd, section_args,  unknown, add_customised_args