def find_closest_weather(weathers_list, unixtime):
    """
    Extracts from the provided list of Weather objects the item which is
    closest in time to the provided UNIXtime.

    :param weathers_list: a list of *Weather* objects
    :type weathers_list: list
    :param unixtime: a UNIX time
    :type unixtime: int
    :returns: the *Weather* object which is closest in time or ``None`` if the
        list is empty
    """
    if not weathers_list:
        return None
    if not is_in_coverage(unixtime, weathers_list):
        raise api_response_error.NotFoundError('Error: the specified time is ' + \
                                'not included in the weather coverage range')
    closest_weather = weathers_list[0]
    time_distance = abs(closest_weather.get_reference_time() - unixtime)
    for weather in weathers_list:
        if abs(weather.get_reference_time() - unixtime) < time_distance:
            time_distance = abs(weather.get_reference_time() - unixtime)
            closest_weather = weather
    return closest_weather
def find_closest_weather ( weathers_list , unixtime ) : if not weathers_list : return None if not is_in_coverage ( unixtime , weathers_list ) : raise api_response_error . NotFoundError ( 'Error: the specified time is ' + 'not included in the weather coverage range' ) closest_weather = weathers_list [ 0 ] time_distance = abs ( closest_weather . get_reference_time ( ) - unixtime ) for weather in weathers_list : if abs ( weather . get_reference_time ( ) - unixtime ) < time_distance : time_distance = abs ( weather . get_reference_time ( ) - unixtime ) closest_weather = weather return closest_weather
Extracts from the provided list of Weather objects the item which is
    closest in time to the provided UNIXtime.

    :param weathers_list: a list of *Weather* objects
    :type weathers_list: list
    :param unixtime: a UNIX time
    :type unixtime: int
    :returns: the *Weather* object which is closest in time or ``None`` if the
        list is empty