import collections


def _split_gin_args(argv, prefix='--gin'):
  """Separates absl and gin args into separate lists."""
  other_args = [argv[0]]
  gin_args = collections.defaultdict(list)
  for arg in argv[1:]:
    if arg.startswith(prefix):
      k, v = arg[len('--'):].split('=', maxsplit=1)
      gin_args[k].append(v)
    else:
      other_args.append(arg)
  return other_args, gin_args