def _get_name_and_arguments(span):
  """Returns function name and argument sub-expressions."""
  span = span.strip()
  paren_index = span.find("(")
  if paren_index == -1:
    raise ValueError("Funql contains no `(`: %s" % span)
  name = span[:paren_index]
  arguments = span[paren_index + 1:]
  if arguments[-1] != ")":
    raise ValueError("Invalid arguments string ends with %s: %s" %
                     (arguments[-1], arguments))
  arguments = _split_arguments(arguments[:-1])
  return name, arguments
Returns function name and argument sub-expressions.
language/compgen/nqg/tasks/geoquery/funql_normalization.py