docs: def _determine_args(argument_groups, arguments, use_all_args=False):
      """
      Determine the arguments to add to a parser (for a pipeline).
  
      :param Iterable[str] | str argument_groups: Collection of names of groups
          of arguments to add to an argument parser.
      :param Iterable[str] | str arguments: Collection of specific arguments to
          add to the parser.
      :param bool use_all_args: Whether to use all arguments defined here.
      :return set[str]: Collection of (unique) argument names to add to a parser.
      """
  
      if sys.version_info < (3, 3):
          from collections import Iterable
      else:
          from collections.abc import Iterable
  
      # Define the argument groups.
      args_by_group = {
          "pypiper": ["recover", "new-start", "dirty", "force-follow"],
          "config": ["config"],
          "checkpoint": ["stop-before", "stop-after"],
          "resource": ["mem", "cores"],
          "looper": ["config", "output-parent", "mem", "cores"],
          "common": ["input", "sample-name"],
          "ngs": ["sample-name", "input", "input2", "genome", "single-or-paired"]
      }
  
      # Handle various types of group specifications.
      groups = None
      if use_all_args:
          groups = args_by_group.keys()
      elif isinstance(argument_groups, str):
          groups = [argument_groups]
      elif isinstance(argument_groups, Iterable):
          groups = argument_groups
      elif argument_groups:
          raise TypeError("arguments must be a str or a list.")
  
      # Collect the groups of arguments.
      final_args = list()
      if groups:
          for g in groups:
              try:
                  this_group_args = args_by_group[g]
              except KeyError:
                  print("Skipping undefined pypiper argument group '{}'".format(g))
              else:
                  final_args.extend(this_group_args)
                  # final_args |= {this_group_args} if \
                  #     isinstance(this_group_args, str) else set(this_group_args)
  
      # Handle various types of specific, individual argument specifications.
      if isinstance(arguments, str):
          final_args.append(arguments)
      elif isinstance(arguments, Iterable):
          final_args.extend(arguments)
      elif arguments:
          raise TypeError("arguments must be a str or a list.")
  
      return uniqify(final_args)