code: def update_pypsa_generator_timeseries(network, generators_to_update=None,
                                        timesteps=None):
      
      _update_pypsa_timeseries_by_type(
          network, type='generator', components_to_update=generators_to_update,
          timesteps=timesteps)
docs: Updates generator time series in pypsa representation.
  
      This function overwrites p_set and q_set of generators_t attribute of
      pypsa network.
      Be aware that if you call this function with `timesteps` and thus overwrite
      current time steps it may lead to inconsistencies in the pypsa network
      since only generator time series are updated but none of the other time
      series or the snapshots attribute of the pypsa network. Use the function
      :func:`update_pypsa_timeseries` to change the time steps you want to
      analyse in the power flow analysis.
      This function will also raise an error when a generator that is currently
      not in the pypsa representation is added.
  
      Parameters
      ----------
      network : Network
          The eDisGo grid topology model overall container
      generators_to_update : :obj:`list`, optional
          List with all generators (of type :class:`~.grid.components.Generator`)
          that need to be updated. If None all generators are updated depending
          on mode. See :meth:`~.tools.pypsa_io.to_pypsa` for more information.
      timesteps : :pandas:`pandas.DatetimeIndex<datetimeindex>` or :pandas:`pandas.Timestamp<timestamp>`
          Timesteps specifies which time steps of the generator time series to
          export to pypsa representation. If None all time steps currently
          existing in pypsa representation are updated. If not None current time
          steps are overwritten by given time steps. Default: None.