def clamp(value, minimum, maximum):
    """ Returns the *value* limited between *minimum* and *maximum*
    whereby the *maximum* wins over the *minimum*.

    Example:

    >>> clamp(64, 0, 255)
    64
    >>> clamp(-128, 0, 255)
    0
    >>> clamp(0, 127, -128)
    -128
    """
    return min(max(value, minimum), maximum)