def bound(x, m, M):
    """
    Bound x between m and M.

    Parameters
    ----------
    x : float
        Value.
    m : float
        Lower bound.
    M : float
        Upper bound.
    """
    return min(max(x, m), M)