def METHOD_NAME(array: np.ndarray, algorithm: str) -> float:
    """Generic contrast function. Different algorithms have different inputs, so caution is advised.
    When possible, the exact contrast function is preferred.
    For Michelson and RMS algorithms, the input array can be any ordinary numpy array.
    For Weber and Ratio algorithms, the array is assumed to be a 2-element array.
    Parameters
    ----------
    array
        The numpy array of the ROI or 2-element input array. This is used in combination with the
        method.
    algorithm
        The contrast method. See :class:`~pylinac.core.contrast.Contrast` for options.
    """
    algorithm = algorithm.lower()
    if algorithm == Contrast.MICHELSON.lower():
        return michelson(array)
    elif algorithm == Contrast.WEBER.lower():
        if array.size != 2:
            raise ValueError(
                "For Weber algorithm, the array must be exactly 2 elements. Consult the ``weber`` function for parameter details"
            )
        return weber(array[0], array[1])
    elif algorithm == Contrast.RMS.lower():
        return rms(array)
    elif algorithm == Contrast.RATIO.lower():
        if array.size != 2:
            raise ValueError(
                "For Ratio algorithm, the array must be exactly 2 elements. Consult the ``ratio`` function for parameter details"
            )
        return ratio(array[0], array[1])
    elif algorithm == Contrast.DIFFERENCE.lower():
        if array.size != 2:
            raise ValueError(
                "For Difference algorithm, the array must be exactly 2 elements. Consult the ``difference`` function for parameter details"
            )
        return difference(array[0], array[1])
    else:
        raise ValueError(
            f"Contrast input of {algorithm} did not match any valid options: {Contrast.__dict__.values()}"
        )