def check_range(x,min_x,max_x):
    """
    >>> print check_range(0,3,7)
    3
    >>> print check_range(10,3,7)
    7
    >>> print check_range(10,7,3)
    3
    """
    x = max(x,min_x)
    x = min(x,max_x)
    return x