docs: def mv_connect_generators(mv_grid_district, graph, debug=False):
      """Connect MV generators to MV grid
  
      Args
      ----
      mv_grid_district: MVGridDistrictDing0
          MVGridDistrictDing0 object for which the connection process has to be
          done
      graph: :networkx:`NetworkX Graph Obj< >`
          NetworkX graph object with nodes
      debug: bool, defaults to False
          If True, information is printed during process.
  
      Returns
      -------
      :networkx:`NetworkX Graph Obj< >`
          NetworkX graph object with nodes and newly created branches
      """
  
      generator_buffer_radius = cfg_ding0.get('mv_connect', 'generator_buffer_radius')
      generator_buffer_radius_inc = cfg_ding0.get('mv_connect', 'generator_buffer_radius_inc')
  
      # WGS84 (conformal) to ETRS (equidistant) projection
      proj1 = partial(
              pyproj.transform,
              pyproj.Proj(init='epsg:4326'),  # source coordinate system
              pyproj.Proj(init='epsg:3035'))  # destination coordinate system
  
      # ETRS (equidistant) to WGS84 (conformal) projection
      proj2 = partial(
              pyproj.transform,
              pyproj.Proj(init='epsg:3035'),  # source coordinate system
              pyproj.Proj(init='epsg:4326'))  # destination coordinate system
  
      for generator in sorted(mv_grid_district.mv_grid.generators(), key=lambda x: repr(x)):
  
          # ===== voltage level 4: generator has to be connected to MV station =====
          if generator.v_level == 4:
              mv_station = mv_grid_district.mv_grid.station()
  
              branch_length = calc_geo_dist_vincenty(generator, mv_station)
  
              # TODO: set branch type to something reasonable (to be calculated)
              branch_kind = mv_grid_district.mv_grid.default_branch_kind
              branch_type = mv_grid_district.mv_grid.default_branch_type
  
              branch = BranchDing0(length=branch_length,
                                   kind=branch_kind,
                                   type=branch_type,
                                   ring=None)
              graph.add_edge(generator, mv_station, branch=branch)
  
              if debug:
                  logger.debug('Generator {0} was connected to {1}'.format(
                      generator, mv_station))
  
          # ===== voltage level 5: generator has to be connected to MV grid (next-neighbor) =====
          elif generator.v_level == 5:
              generator_shp = transform(proj1, generator.geo_data)
  
              # get branches within a the predefined radius `generator_buffer_radius`
              branches = calc_geo_branches_in_buffer(generator,
                                                     mv_grid_district.mv_grid,
                                                     generator_buffer_radius,
                                                     generator_buffer_radius_inc, proj1)
  
              # calc distance between generator and grid's lines -> find nearest line
              conn_objects_min_stack = find_nearest_conn_objects(generator_shp,
                                                                 branches,
                                                                 proj1,
                                                                 conn_dist_weight=1,
                                                                 debug=debug,
                                                                 branches_only=False)
  
              # connect!
              # go through the stack (from nearest to most far connection target object)
              generator_connected = False
              for dist_min_obj in conn_objects_min_stack:
                  # Note 1: conn_dist_ring_mod=0 to avoid re-routing of existent lines
                  # Note 2: In connect_node(), the default cable/line type of grid is used. This is reasonable since
                  #         the max. allowed power of the smallest possible cable/line type (3.64 MVA for overhead
                  #         line of type 48-AL1/8-ST1A) exceeds the max. allowed power of a generator (4.5 MVA (dena))
                  #         (if connected separately!)
                  target_obj_result = connect_node(generator,
                                                   generator_shp,
                                                   mv_grid_district.mv_grid,
                                                   dist_min_obj,
                                                   proj2,
                                                   graph,
                                                   conn_dist_ring_mod=0,
                                                   debug=debug)
  
                  if target_obj_result is not None:
                      if debug:
                          logger.debug(
                              'Generator {0} was connected to {1}'.format(
                                  generator, target_obj_result))
                      generator_connected = True
                      break
  
              if not generator_connected and debug:
                  logger.debug(
                      'Generator {0} could not be connected, try to '
                      'increase the parameter `generator_buffer_radius` in '
                      'config file `config_calc.cfg` to gain more possible '
                      'connection points.'.format(generator))
  
      return graph