def Clamp01(num):
    """
    Returns ``num`` clamped between 0 and 1.

    Parameters
    ----------
    num : float
        Input number

    """
    if num < 0:
        return 0
    if num > 1:
        return 1
    return num