docs: def extend_distribution_substation_overloading(network, critical_stations):
      """
      Reinforce MV/LV substations due to overloading issues.
  
      In a first step a parallel transformer of the same kind is installed.
      If this is not sufficient as many standard transformers as needed are
      installed.
  
      Parameters
      ----------
      network : :class:`~.grid.network.Network`
      critical_stations : :pandas:`pandas.DataFrame<dataframe>`
          Dataframe containing over-loaded MV/LV stations, their apparent power
          at maximal over-loading and the corresponding time step.
          Index of the dataframe are the over-loaded stations of type
          :class:`~.grid.components.LVStation`. 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>`. See
          :func:`~.flex_opt.check_tech_constraints.mv_lv_station_load` for more
          information.
  
      Returns
      -------
      dict
          Dictionary with lists of added and removed transformers.
  
      """
  
      # get parameters for standard transformer
      try:
          standard_transformer = network.equipment_data['lv_trafos'].loc[
              network.config['grid_expansion_standard_equipment'][
                  'mv_lv_transformer']]
      except KeyError:
          print('Standard MV/LV transformer is not in equipment list.')
  
      transformers_changes = {'added': {}, 'removed': {}}
      for station in critical_stations.index:
  
          # list of maximum power of each transformer in the station
          s_max_per_trafo = [_.type.S_nom for _ in station.transformers]
  
          # maximum station load from power flow analysis
          s_station_pfa = critical_stations.s_pfa[station]
  
          # determine missing transformer power to solve overloading issue
          case = network.timeseries.timesteps_load_feedin_case.case[
              critical_stations.time_index[station]]
          load_factor = network.config['grid_expansion_load_factors'][
              'lv_{}_transformer'.format(case)]
          s_trafo_missing = s_station_pfa - (sum(s_max_per_trafo) * load_factor)
  
          # check if second transformer of the same kind is sufficient
          # if true install second transformer, otherwise install as many
          # standard transformers as needed
          if max(s_max_per_trafo) >= s_trafo_missing:
              # if station has more than one transformer install a new
              # transformer of the same kind as the transformer that best
              # meets the missing power demand
              duplicated_transformer = min(
                  [_ for _ in station.transformers
                   if _.type.S_nom > s_trafo_missing],
                  key=lambda j: j.type.S_nom - s_trafo_missing)
  
              new_transformer = Transformer(
                  id='LVStation_{}_transformer_{}'.format(
                      str(station.id), str(len(station.transformers) + 1)),
                  geom=duplicated_transformer.geom,
                  mv_grid=duplicated_transformer.mv_grid,
                  grid=duplicated_transformer.grid,
                  voltage_op=duplicated_transformer.voltage_op,
                  type=copy.deepcopy(duplicated_transformer.type))
  
              # add transformer to station and return value
              station.add_transformer(new_transformer)
              transformers_changes['added'][station] = [new_transformer]
  
          else:
              # get any transformer to get attributes for new transformer from
              station_transformer = station.transformers[0]
  
              # calculate how many parallel standard transformers are needed
              number_transformers = math.ceil(
                  s_station_pfa / standard_transformer.S_nom)
  
              # add transformer to station
              new_transformers = []
              for i in range(number_transformers):
                  new_transformer = Transformer(
                      id='LVStation_{}_transformer_{}'.format(
                          str(station.id), str(i + 1)),
                      geom=station_transformer.geom,
                      mv_grid=station_transformer.mv_grid,
                      grid=station_transformer.grid,
                      voltage_op=station_transformer.voltage_op,
                      type=copy.deepcopy(standard_transformer))
                  new_transformers.append(new_transformer)
              transformers_changes['added'][station] = new_transformers
              transformers_changes['removed'][station] = station.transformers
              station.transformers = new_transformers
      return transformers_changes