old_contents: def buses_of_vlvl(network, voltage_level):
      """ Get bus-ids of given voltage level(s).
  
      Parameters
      ----------
      network : :class:`pypsa.Network
          Overall container of PyPSA
      voltage_level: list
  
      Returns
      -------
      list
          List containing bus-ids.
      """
  
      mask = network.buses.v_nom.isin(voltage_level)
      df = network.buses[mask]
  
      return df.index
  
  
  def buses_grid_linked(network, voltage_level):
      """ Get bus-ids of a given voltage level connected to the grid.
  
      Parameters
      ----------
      network : :class:`pypsa.Network
          Overall container of PyPSA
      voltage_level: list
  
      Returns
      -------
      list
          List containing bus-ids.
      """
  
      mask = ((network.buses.index.isin(network.lines.bus0) |
              (network.buses.index.isin(network.lines.bus1))) &
              (network.buses.v_nom.isin(voltage_level)))
  
      df = network.buses[mask]
  
      return df.index
  
  
  def connected_grid_lines(network, busids):
      """ Get grid lines connected to given buses.
  
      Parameters
      ----------
      network : :class:`pypsa.Network
          Overall container of PyPSA
      busids  : list
          List containing bus-ids.
  
      Returns
      -------
      :class:`pandas.DataFrame
          PyPSA lines.
      """
  
      mask = network.lines.bus1.isin(busids) |\
          network.lines.bus0.isin(busids)
  
      return network.lines[mask]
  
  
  def connected_transformer(network, busids):
      """ Get transformer connected to given buses.
  
      Parameters
      ----------
      network : :class:`pypsa.Network
          Overall container of PyPSA
      busids  : list
          List containing bus-ids.
  
      Returns
      -------
      :class:`pandas.DataFrame
          PyPSA transformer.
      """
  
      mask = (network.transformers.bus0.isin(busids))
  
      return network.transformers[mask]
  
new_contents: def buses_of_vlvl(network, voltage_level):
      """ Get bus-ids of given voltage level(s).
  
      Parameters
      ----------
      network : :class:`pypsa.Network
          Overall container of PyPSA
      voltage_level: list
  
      Returns
      -------
      list
          List containing bus-ids.
      """
  
      mask = network.buses.v_nom.isin(voltage_level)
      df = network.buses[mask]
  
      return df.index
  
  
  def buses_grid_linked(network, voltage_level):
      """ Get bus-ids of a given voltage level connected to the grid.
  
      Parameters
      ----------
      network : :class:`pypsa.Network
          Overall container of PyPSA
      voltage_level: list
  
      Returns
      -------
      list
          List containing bus-ids.
      """
  
      mask = ((network.buses.index.isin(network.lines.bus0) |
              (network.buses.index.isin(network.lines.bus1))) &
              (network.buses.v_nom.isin(voltage_level)))
  
      df = network.buses[mask]
  
      return df.index
  
  
  def connected_grid_lines(network, busids):
      """ Get grid lines connected to given buses.
  
      Parameters
      ----------
      network : :class:`pypsa.Network
          Overall container of PyPSA
      busids  : list
          List containing bus-ids.
  
      Returns
      -------
      :class:`pandas.DataFrame
          PyPSA lines.
      """
  
      mask = network.lines.bus1.isin(busids) |\
          network.lines.bus0.isin(busids)
  
      return network.lines[mask]
  
  
  def connected_transformer(network, busids):
      """ Get transformer connected to given buses.
  
      Parameters
      ----------
      network : :class:`pypsa.Network
          Overall container of PyPSA
      busids  : list
          List containing bus-ids.
  
      Returns
      -------
      :class:`pandas.DataFrame
          PyPSA transformer.
      """
  
      mask = (network.transformers.bus0.isin(busids))
  
      return network.transformers[mask]
  
  
  def load_shedding (network, marginal_cost=1e4, p_nom=1e6): 
      """ Implement load shedding in existing network to identify feasibility problems
      ----------
      network : :class:`pypsa.Network
          Overall container of PyPSA
      marginal_cost : int 
          Marginal costs for load shedding
      p_nom : int
          Installed capacity of load shedding generator
      Returns
      -------
  
      """
  
      network.add("Carrier", "load")
      network.import_components_from_dataframe(
      pd.DataFrame(
      dict(marginal_cost=marginal_cost,
      p_nom=p_nom,
      carrier='load shedding',
      bus=network.buses.index),
      index=network.buses.index + ' load'),
      "Generator"
      )
  
      return 
  
subject: implement load_shedding