from typing import List
from typing import Tuple
import math


def partition_indexes(total_size: int, chunk_size: int) -> List[Tuple[int, int]]:
    """
    given the total_size of the list or a dataframe and the size of the chunks, it returns the list of tuples,
    where each tuple contains the starting and ending index for each computed chunk inside a list or a dataframe
    :param total_size: length of a list or size of a dataframe
    :param chunk_size: size of the chunk
    :return: list of tuples for chunk's start and end indices
    """
    # Compute the chunk size (integer division; i.e. assuming Python 2.7)
    num_of_partitions = math.ceil(total_size / chunk_size)
    # How many chunks need an extra 1 added to the size?
    remainder = total_size - chunk_size * num_of_partitions
    a = 0
    indexes = []
    for i in range(num_of_partitions):
        b = a + chunk_size + (i < remainder)
        # Yield the inclusive-inclusive range
        indexes.append((a, b))
        a = b

    return indexes