<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def select_station( candidates, coverage_range=None, min_fraction_coverage=0.9, distance_warnings=(50000, 200000), rank=1, ):
 """ Select a station from a list of candidates that meets given data quality criteria. Parameters candidates : :any:`pandas.DataFrame` A dataframe of the form given by :any:`eeweather.rank_stations` or :any:`eeweather.combine_ranked_stations`, specifically having at least an index with ``usaf_id`` values and the column ``distance_meters``. Returns ------- isd_station, warnings : tuple of (:any:`eeweather.ISDStation`, list of str) A qualified weather station. ``None`` if no station meets criteria. """


    def _test_station(station):
        if coverage_range is None:
            return True, []
        else:
            start_date, end_date = coverage_range
            try:
                tempC, warnings = eeweather.mockable.load_isd_hourly_temp_data(
                    station, start_date, end_date
                )
            except ISDDataNotAvailableError:
                return False, []  # reject

            # TODO(philngo): also need to incorporate within-day limits
            if len(tempC) > 0:
                fraction_coverage = tempC.notnull().sum() / float(len(tempC))
                return (fraction_coverage > min_fraction_coverage), warnings
            else:
                return False, []  # reject

    def _station_warnings(station, distance_meters):
        return [
            EEWeatherWarning(
                qualified_name="eeweather.exceeds_maximum_distance",
                description=(
                    "Distance from target to weather station is greater"
                    "than the specified km."
                ),
                data={
                    "distance_meters": distance_meters,
                    "max_distance_meters": d,
                    "rank": rank,
                },
            )
            for d in distance_warnings
            if distance_meters > d
        ]

    n_stations_passed = 0
    for usaf_id, row in candidates.iterrows():
        station = ISDStation(usaf_id)
        test_result, warnings = _test_station(station)
        if test_result:
            n_stations_passed += 1
        if n_stations_passed == rank:
            if not warnings:
                warnings = []
            warnings.extend(_station_warnings(station, row.distance_meters))
            return station, warnings

    no_station_warning = EEWeatherWarning(
        qualified_name="eeweather.no_weather_station_selected",
        description=(
            "No weather station found with the specified rank and"
            " minimum fracitional coverage."
        ),
        data={"rank": rank, "min_fraction_coverage": min_fraction_coverage},
    )
    return None, [no_station_warning]