import math


def effective_priority(value, levels):
    """
    Method to determine effective priority given a distinct number of
    levels supported. Returns the lowest priority value that is of
    equivalent priority to the value passed in.
    """
    if value <= 5-math.ceil(levels/2.0): return 0
    if value >= 4+math.floor(levels/2.0): return 4+math.floor(levels/2.0)
    return value