code: def remove_cmdline_arg(args, arg, n=1):
      
      if arg in args:
          idx = args.index(arg)
          args = list(args)
          del args[idx:idx + max(n, 1)]
      return args
docs: Removes the command line argument *args* from a list of arguments *args*, e.g. as returned from
      :py:func:`global_cmdline_args`. When *n* is 1 or less, only the argument is removed. Otherwise,
      the following *n-1* values are removed. Example:
  
      .. code-block:: python
  
          args = global_cmdline_values()
          # -> ["--local-scheduler", "--workers", "4"]
  
          remove_cmdline_arg(args, "--local-scheduler")
          # -> ["--workers", "4"]
  
          remove_cmdline_arg(args, "--workers", 2)
          # -> ["--local-scheduler"]