class_docstr: Subclass of argparse ArgumentParser which adds optional calls to sample from lists or ranges
  Also enables running optimizations across parallel processes
class_docstr_tok: ["Subclass","of","argparse","ArgumentParser","which","adds","optional","calls","to","sample","from","lists","or","ranges","Also","enables","running","optimizations","across","parallel","processes"]
code: def __whitelist_cluster_commands(self, args, argv):
      parsed = {}
  
      # build a dict where key = arg, value = value of the arg or None if just a flag
      for i, arg_candidate in enumerate(argv):
          arg = None
          value = None
  
          # only look at --keys
          if "--" not in arg_candidate:
              continue
  
          # skip items not on the white list
          if arg_candidate[2:] not in HyperOptArgumentParser.CMD_MAP:
              continue
  
          arg = arg_candidate[2:]
          # pull out the value of the argument if given
          if i + 1 <= len(argv) - 1:
              if "--" not in argv[i + 1]:
                  value = argv[i + 1]
  
              if arg is not None:
                  parsed[arg] = value
          else:
              if arg is not None:
                  parsed[arg] = value
  
      # add the whitelist cmds to the args
      all_values = set()
      for k, v in args.__dict__.items():
          all_values.add(k)
          all_values.add(v)
  
      for arg, v in parsed.items():
          v_parsed = self.__parse_primitive_arg_val(v)
          all_values.add(v)
          all_values.add(arg)
          args.__setattr__(arg, v_parsed)
  
      # make list with only the unknown args
      unk_args = []
      for arg in argv:
          arg_candidate = re.sub("--", "", arg)
          is_bool = arg_candidate == "True" or arg_candidate == "False"
          if is_bool:
              continue
  
          if arg_candidate not in all_values:
              unk_args.append(arg)
  
      # when no bad args are left, return none to be consistent with super api
      if len(unk_args) == 0:
          unk_args = None
  
      # add hpc_exp_number if not passed in so we can never get None
      if HyperOptArgumentParser.SLURM_EXP_CMD not in args:
          args.__setattr__(HyperOptArgumentParser.SLURM_EXP_CMD, None)
  
      return args, unk_args
  
imports: import argparse
  import json
  import math
  import os
  import random
  import re
  import traceback
  from argparse import ArgumentParser
  from copy import deepcopy
  from gettext import gettext
  from multiprocessing import Pool, Queue
  from time import sleep
  import numpy
  from .hyper_opt_utils import strategies
label_desc: Use image node_id 9 for calling the HyperOptArgumentParser obj's underlying member method code with example usage: obj.__whitelist_cluster_commands(args, argv) and returns: args,  unk_args