def batch_data(data, batch_size):
    """Given a list, batch that list into chunks of size batch_size

    Args:
        data (List): list to be batched
        batch_size (int): size of each batch

    Returns:
        batches (List[List]): a list of lists, each inner list of size batch_size except possibly
            the last one.
    """
    batches = [data[i : i + batch_size] for i in range(0, len(data), batch_size)]
    return batches