def percent_diff(value1: float, value2: float, frac: bool = False) -> float:
    """ Return the percentage difference between two values. The denominator
            is the average of value1 and value2.

            value1: float, first value

            value2: float, second value

            frac: bool, Default is False. Set to True returns a fraction
                instead of percentages. This is useful for performing
                calculations on spreadsheets.

            return: float, absolute value of the difference in percentages

            Usage
            -----
            >>> percent_diff(5, 7)
            33.33333333333333
            >>> percent_diff(5, 7, frac=True)
            0.3333333333333333
        """
    assert value1 >= 0 and value2 >= 0, 'Values must not be negative'
    perdiff = abs(value1 - value2)/((value1 + value2)/2.0)
    if frac is False:
        perdiff *= 100
    return perdiff