from typing import Sequence
from typing import Any
from typing import Tuple


def _split_args(
    args: Sequence[Any],
    preds: Sequence[bool],
) -> Tuple[Tuple[Tuple[int, Any]], ...]:
  """Split args into two lists based on some predicates."""
  assert len(args) == len(preds), (len(args), len(preds))
  true_args = []
  false_args = []
  for idx, (arg, pred) in enumerate(zip(args, preds)):
    if pred:
      true_args.append((idx, arg))
    else:
      false_args.append((idx, arg))
  return tuple(true_args), tuple(false_args)