import math


def normalize_function(foo, interval=(0, 1), precision=100):
    """
    Normalizes function on given interval.

    Args:
        foo (function): Function to be normalized.
        interval (tuple): Interval of normalization.
        precision (int): Precision of numerical calculations.

    Returns:
        function: Normalized function.
    """
    start, end = interval
    norm = sum([foo(start + k/precision) for k in range(math.floor(precision*(end-start)))])/math.floor(precision*(end-start))
    # print(norm)
    return lambda x: foo(x)/norm