def METHOD_NAME(
    indices,
    num_tokens_vec,
    max_tokens,
    max_sentences,
    bsz_mult,
):
    def num_tokens_fn(idx):
        return num_tokens_vec[idx]
    return batch_by_size_fn(
        indices, num_tokens_fn, max_tokens, max_sentences, bsz_mult
    )