<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove_arg(args, arg, has_param=False):
 """Removes the first instance of the specified arg from the list of args. If the arg is present and has_param is set, also removes the parameter that follows the arg. :param list args: strings representing an argument list. :param staring arg: argument to remove from the list. :param bool has_param: if true, also remove the parameter that follows arg in the list. :return: possibly modified list of args. """

  for idx, found_arg in enumerate(args):
    if found_arg == arg:
      if has_param:
        slice_idx = idx + 2
      else:
        slice_idx = idx + 1
      args = args[:idx] + args[slice_idx:]
      break
  return args