def METHOD_NAME(
    lst: Sequence[Sequence[str]], n: Optional[int]
) -> Iterable[Sequence[Sequence[str]]]:
    """
    Split input to chunks of up to n items each
    """
    if n is None or n == -1:
        n = len(lst)
    for i in range(0, len(lst), n):
        yield lst[i : i + n]