def get_sequence_lengths(data: list) -> list:
    """Returns the lengths of every row in the given data. The data must be arranged in batches or the function will
    fail.

    Params:
    - data (list): The list of data (arranged in batches) whose length is to be found

    Returns:
    - timestep_lengths (list): The lengths of the sequences of every batch in the given data
    """
    batch_lengths = list()
    for batch in data:
        item_row_lengths = [batch[0]]
        item_row_lengths += [len(row) for row in batch[1:-1]]
        item_row_lengths += [batch[-1]]
        batch_lengths.append(item_row_lengths)
    return batch_lengths