utils.py
def nearest(items, pivot):
    """
    General function for finding the entry in items that is nearest to pivot.

    :param items: Array of numbers or datetime objects
    :param pivot: Single number of datetime object
    :return:
    """
    return min(items, key=lambda x: abs(x - pivot))

    General function for finding the entry in items that is nearest to pivot.

    :param items: Array of numbers or datetime objects
    :param pivot: Single number of datetime object
    :return:
    
General function for finding the entry in items that is nearest to pivot.
General function for finding the entry in items that is nearest to pivot .
def nearest(items, pivot):
    return min(items, key=lambda x: abs(x - pivot))
def nearest ( items , pivot ) : return min ( items , key = lambda x : abs ( x - pivot ) )
General function for finding the entry in items that is nearest to pivot.
General function for finding the entry in items that is nearest to pivot .
"""
    General function for finding the entry in items that is nearest to pivot.

    :param items: Array of numbers or datetime objects
    :param pivot: Single number of datetime object
    :return:
    """
None
items
Array of numbers or datetime objects
Array of numbers or datetime objects
pivot
Single number of datetime object
Single number of datetime object