def _split_arguments(args_string):
  """Splits comma-joined argument list.

  For example, an input of "foo, bar(xyz, abc), bar" will be split
  into: ["foo", "bar(xyz, abc)", "bar"].

  Args:
    args_string: String input for comma-separated argument list.

  Returns:
    List of Strings for each argument.
  """
  argument_buffer = []
  arguments = []
  open_parens = 0
  for char in args_string:
    if char == "," and open_parens == 0:
      arguments.append("".join(argument_buffer))
      argument_buffer = []
    elif char == " " and not argument_buffer:
      continue
    else:
      if char == "(":
        open_parens += 1
      elif char == ")":
        open_parens -= 1
      argument_buffer.append(char)
  arguments.append("".join(argument_buffer))
  return arguments
Splits comma-joined argument list.

  For example, an input of "foo, bar(xyz, abc), bar" will be split
  into: ["foo", "bar(xyz, abc)", "bar"].

  Args:
    args_string: String input for comma-separated argument list.

  Returns:
    List of Strings for each argument.
  
language/compgen/nqg/tasks/geoquery/tmcd_utils.py