code: def validate_arguments(log, whitelisted_args, args):
      
      valid_patterns = {re.compile(p): v for p, v in whitelisted_args.items()}
  
      def validate(idx):
        arg = args[idx]
        for pattern, has_argument in valid_patterns.items():
          if pattern.match(arg):
            return 2 if has_argument else 1
        log.warn("Zinc argument '{}' is not supported, and is subject to change/removal!".format(arg))
        return 1
  
      arg_index = 0
      while arg_index < len(args):
        arg_index += validate(arg_index)
docs: Validate that all arguments match whitelisted regexes.