<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _station_load(network, station, crit_stations):
 """ Checks for over-loading of stations. Parameters network : :class:`~.grid.network.Network` station : :class:`~.grid.components.LVStation` or :class:`~.grid.components.MVStation` crit_stations : :pandas:`pandas.DataFrame<dataframe>` Dataframe containing over-loaded stations, their apparent power at maximal over-loading and the corresponding time step. Index of the dataframe are the over-loaded stations either of type :class:`~.grid.components.LVStation` or :class:`~.grid.components.MVStation`. Columns are 's_pfa' containing the apparent power at maximal over-loading as float and 'time_index' containing the corresponding time step the over-loading occured in as :pandas:`pandas.Timestamp<timestamp>`. Returns ------- :pandas:`pandas.DataFrame<dataframe>` Dataframe containing over-loaded stations, their apparent power at maximal over-loading and the corresponding time step. Index of the dataframe are the over-loaded stations either of type :class:`~.grid.components.LVStation` or :class:`~.grid.components.MVStation`. Columns are 's_pfa' containing the apparent power at maximal over-loading as float and 'time_index' containing the corresponding time step the over-loading occured in as :pandas:`pandas.Timestamp<timestamp>`. """

    if isinstance(station, LVStation):
        grid_level = 'lv'
    else:
        grid_level = 'mv'

    # maximum allowed apparent power of station for feed-in and load case
    s_station = sum([_.type.S_nom for _ in station.transformers])
    s_station_allowed_per_case = {}
    s_station_allowed_per_case['feedin_case'] = s_station * network.config[
        'grid_expansion_load_factors']['{}_feedin_case_transformer'.format(
        grid_level)]
    s_station_allowed_per_case['load_case'] = s_station * network.config[
        'grid_expansion_load_factors']['{}_load_case_transformer'.format(
        grid_level)]
    # maximum allowed apparent power of station in each time step
    s_station_allowed = \
        network.timeseries.timesteps_load_feedin_case.case.apply(
            lambda _: s_station_allowed_per_case[_])

    try:
        if isinstance(station, LVStation):
            s_station_pfa = network.results.s_res(
                station.transformers).sum(axis=1)
        else:
            s_station_pfa = network.results.s_res([station]).iloc[:, 0]
        s_res = s_station_allowed - s_station_pfa
        s_res = s_res[s_res < 0]
        # check if maximum allowed apparent power of station exceeds
        # apparent power from power flow analysis at any time step
        if not s_res.empty:
            # find out largest relative deviation
            load_factor = \
                network.timeseries.timesteps_load_feedin_case.case.apply(
                    lambda _: network.config[
                        'grid_expansion_load_factors'][
                        '{}_{}_transformer'.format(grid_level, _)])
            relative_s_res = load_factor * s_res
            crit_stations = crit_stations.append(pd.DataFrame(
                {'s_pfa': s_station_pfa.loc[relative_s_res.idxmin()],
                 'time_index': relative_s_res.idxmin()},
                index=[station]))

    except KeyError:
        logger.debug('No results for {} station to check overloading.'.format(
            grid_level.upper()))

    return crit_stations