import functools


def check_range(low, high):
    """
    Decorator for funcs whose output should match specified boundaries.
    Recalls fuction while the output not matching the boundaries.

    :param (int, float) low: lower bound.
    :param (int, float) high: upper bound.
    :param function func: function to decorate.
    :return: decorated function.
    :rtype: function
    """
    def wrapper(func):
        @functools.wraps(func)
        def inner(*args, **kwargs):
            while True:
                result = func(*args, **kwargs)
                if low <= result <= high:
                    return result
                else:
                    print('Not in range {} - {}. '
                          'Try again.'.format(low, high))
        return inner
    return wrapper