docs: def build_network(self, network=None, *args, **kwargs):
          """  Core method to construct PyPSA Network object.
          """
          # TODO: build_network takes care of divergences in database design and
          # future PyPSA changes from PyPSA's v0.6 on. This concept should be
          # replaced, when the oedb has a revision system in place, because
          # sometime this will break!!!
  
          if network != None:
              network = network
  
          else:
              network = pypsa.Network()
              network.set_snapshots(self.timeindex)
  
          timevarying_override = False
  
          if pypsa.__version__ == '0.11.0':
              old_to_new_name = {'Generator':
                                 {'p_min_pu_fixed': 'p_min_pu',
                                  'p_max_pu_fixed': 'p_max_pu',
                                  'source': 'carrier',
                                  'dispatch': 'former_dispatch'},
                                 'Bus':
                                 {'current_type': 'carrier'},
                                 'Transformer':
                                 {'trafo_id': 'transformer_id'},
                                 'Storage':
                                 {'p_min_pu_fixed': 'p_min_pu',
                                  'p_max_pu_fixed': 'p_max_pu',
                                  'soc_cyclic': 'cyclic_state_of_charge',
                                  'soc_initial': 'state_of_charge_initial',
                                  'source': 'carrier'}}
  
              timevarying_override = True
  
          else:
  
              old_to_new_name = {'Storage':
                                 {'soc_cyclic': 'cyclic_state_of_charge',
                                  'soc_initial': 'state_of_charge_initial'}}
  
          for comp, comp_t_dict in self.config.items():
  
              # TODO: This is confusing, should be fixed in db
              pypsa_comp_name = 'StorageUnit' if comp == 'Storage' else comp
  
              df = self.fetch_by_relname(comp)
  
              if comp in old_to_new_name:
  
                  tmp = old_to_new_name[comp]
                  df.rename(columns=tmp, inplace=True)
  
              network.import_components_from_dataframe(df, pypsa_comp_name)
  
              if comp_t_dict:
  
                  for comp_t, columns in comp_t_dict.items():
  
                      for col in columns:
  
                          df_series = self.series_fetch_by_relname(comp_t, col)
  
                          # TODO: VMagPuSet is not implemented.
                          if timevarying_override and comp == 'Generator' \
                          and not df_series.empty:
                              idx = df[df.former_dispatch == 'flexible'].index
                              idx = [i for i in idx if i in df_series.columns]
                              df_series.drop(idx, axis=1, inplace=True)
  
                          try:
  
                              pypsa.io.import_series_from_dataframe(
                                  network,
                                  df_series,
                                  pypsa_comp_name,
                                  col)
  
                          except (ValueError, AttributeError):
                              print("Series %s of component %s could not be "
                                    "imported" % (col, pypsa_comp_name))
  
          # populate carrier attribute in PyPSA network
          network.import_components_from_dataframe(
              self.fetch_by_relname(carr_ormclass), 'Carrier')
  
          self.network = network
  
          return network