def index_to_coordinates(string, index):
    """ Returns the corresponding tuple (line, column) of the character at the given index of the given string.
    """
    if index < 0:
        index =  index % len(string)
    sp = string[:index+1].splitlines(keepends=True)
    return len(sp), len(sp[-1])