docs: def select_grid_model_ria(lvgd, sector):
      """Select a typified grid for retail/industrial and agricultural
  
      Parameters
      ----------
      lvgd : ding0.core.structure.regions.LVGridDistrictDing0
          Low-voltage grid district object
      sector : str
          Either 'retail/industrial' or 'agricultural'. Depending on choice
          different parameters to grid topology apply
  
      Returns
      -------
      :obj:`dict`
          Parameters that describe branch lines of a sector
      """
  
      cable_lf = cfg_ding0.get('assumptions',
                               'load_factor_lv_cable_lc_normal')
  
      cos_phi_load = cfg_ding0.get('assumptions',
                                   'cos_phi_load')
  
      max_lv_branch_line_load = cfg_ding0.get('assumptions',
                                              'max_lv_branch_line')
  
      # make a distinction between sectors
      if sector == 'retail/industrial':
          max_branch_length = cfg_ding0.get(
              "assumptions",
              "branch_line_length_retail_industrial")
          peak_load = lvgd.peak_load_retail + \
                      lvgd.peak_load_industrial
          count_sector_areas = lvgd.sector_count_retail + \
                               lvgd.sector_count_industrial
      elif sector == 'agricultural':
          max_branch_length = cfg_ding0.get(
              "assumptions",
              "branch_line_length_agricultural")
          peak_load = lvgd.peak_load_agricultural
          count_sector_areas = lvgd.sector_count_agricultural
      else:
          raise ValueError('Sector {} does not exist!'.format(sector))
  
      # determine size of a single load
      single_peak_load = peak_load / count_sector_areas
  
      # if this single load exceeds threshold of 300 kVA it is splitted
      while single_peak_load > (max_lv_branch_line_load * (cable_lf * cos_phi_load)):
          single_peak_load = single_peak_load / 2
          count_sector_areas = count_sector_areas * 2
  
      grid_model = {}
  
      # determine parameters of branches and loads connected to the branch
      # line
      if 0 < single_peak_load:
          grid_model['max_loads_per_branch'] = math.floor(
              (max_lv_branch_line_load * (cable_lf * cos_phi_load)) / single_peak_load)
          grid_model['single_peak_load'] = single_peak_load
          grid_model['full_branches'] = math.floor(
              count_sector_areas / grid_model['max_loads_per_branch'])
          grid_model['remaining_loads'] = count_sector_areas - (
              grid_model['full_branches'] * grid_model['max_loads_per_branch']
          )
          grid_model['load_distance'] = max_branch_length / (
              grid_model['max_loads_per_branch'] + 1)
          grid_model['load_distance_remaining'] = max_branch_length / (
              grid_model['remaining_loads'] + 1)
      else:
          if count_sector_areas > 0:
              logger.warning(
                  'LVGD {lvgd} has in sector {sector} no load but area count'
                  'is {count}. This is maybe related to #153'.format(
                      lvgd=lvgd,
                      sector=sector,
                      count=count_sector_areas))
              grid_model = None
  
      # add consumption to grid_model for assigning it to the load object
      # consumption is given per sector and per individual load
      if sector == 'retail/industrial':
          grid_model['consumption'] = {
              'retail': lvgd.sector_consumption_retail / (
                  grid_model['full_branches'] *
                  grid_model['max_loads_per_branch'] +
                  grid_model['remaining_loads']),
              'industrial': lvgd.sector_consumption_industrial / (
                  grid_model['full_branches'] *
                  grid_model['max_loads_per_branch'] +
                  grid_model['remaining_loads'])}
      elif sector == 'agricultural':
          grid_model['consumption'] = {
              'agricultural': lvgd.sector_consumption_agricultural / (
                  grid_model['full_branches'] *
                  grid_model['max_loads_per_branch'] +
                  grid_model['remaining_loads'])}
  
      return grid_model