import math


def get_indices(width, height, xpartition, ypartition, xinput, yinput):
    """
    Function to get the indices for grid.

    Args:
        width (float): width of the pitch.
        height (float): height of the pitch.
        xpartition (int): number of rows in a grid
        ypartition (int): number of colimns in a grid.
        xinput (float): x-coordinate location.
        yinput (float): y-coordinate location.

    Returns:
        tuple: containing indices for the grid.
    """    
    ## calculate number of partitions in x and y
    x_step = width / xpartition
    y_step = height / ypartition

    ## calculate x and y values
    x = math.ceil((xinput if xinput > 0 else 0.5) / x_step) # handle border cases as well
    y = math.ceil((yinput if yinput > 0 else 0.5) / y_step)  # handle border cases as well

    return (
        ypartition - y, x - 1
    )