code: def connect_storage(storage, node):
      
  
      # add storage itself to graph
      storage.grid.graph.add_node(storage, type='storage')
  
      # add 1m connecting line to node the storage is connected to
      if isinstance(storage.grid, MVGrid):
          voltage_level = 'mv'
      else:
          voltage_level = 'lv'
  
      # necessary apparent power the line must be able to carry is set to be
      # the storages nominal power and equal amount of reactive power devided by
      # the minimum load factor
      lf_dict = storage.grid.network.config['grid_expansion_load_factors']
      lf = min(lf_dict['{}_feedin_case_line'.format(voltage_level)],
               lf_dict['{}_load_case_line'.format(voltage_level)])
      apparent_power_line = sqrt(2) * storage.nominal_power / lf
      line_type, line_count = select_cable(storage.grid.network, voltage_level,
                                           apparent_power_line)
      line = Line(
          id=storage.id,
          type=line_type,
          kind='cable',
          length=1e-3,
          grid=storage.grid,
          quantity=line_count)
  
      storage.grid.graph.add_edge(node, storage, line=line, type='line')
  
      return line
docs: Connects storage to the given node.
  
      The storage is connected by a cable
      The cable the storage is connected with is selected to be able to carry
      the storages nominal power and equal amount of reactive power.
      No load factor is considered.
  
      Parameters
      ----------
      storage : :class:`~.grid.components.Storage`
          Storage instance to be integrated into the grid.
      node : :class:`~.grid.components.Station` or :class:`~.grid.components.BranchTee`
          Node the storage will be connected to.
  
      Returns
      -------
      :class:`~.grid.components.Line`
          Newly added line to connect storage.