def get_failure_array(pattern):
    """Calculates the new index we should go to if we fail a comparison
    
    Parameters
    ----------
    pattern: str
        The pattern to be identified


    Returns
    -------
    list
        List of indices for the failure table
    """
    failure = [0]
    i = 0
    j = 1
    while j < len(pattern):
        if pattern[i] == pattern[j]:
            i += 1
        elif i > 0:
            i = failure[i-1]
            continue
        j += 1
        failure.append(i)
    return failure