code: def _auto_fill(
      series: TimeSeries, **interpolate_kwargs
  ) -> TimeSeries:
      """
      This function fills the missing values in the TimeSeries `series`,
      using the `pandas.Dataframe.interpolate()` method.
  
      Parameters
      ----------
      series
          The time series
      interpolate_kwargs
          Keyword arguments for `pandas.Dataframe.interpolate()`.
          See `the documentation
          <https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.interpolate.html>`_
          for the list of supported parameters.
      Returns
      -------
      TimeSeries
          A new TimeSeries with all missing values filled according to the rules above.
      """
  
      series_temp = series.pd_dataframe()
  
      # pandas interpolate wrapper, with chosen `method`
      if "limit_direction" not in interpolate_kwargs:
          interpolate_kwargs["limit_direction"] = "both"
      interpolate_kwargs["inplace"] = True
      series_temp.interpolate(**interpolate_kwargs)
      return TimeSeries.from_dataframe(
          series_temp,
          freq=series.freq,
          static_covariates=series.static_covariates,
          hierarchy=series.hierarchy,
      )
  
imports: from typing import List, Optional, Union
  from darts.logging import get_logger, raise_if, raise_if_not
  from darts.timeseries import TimeSeries
label_desc: Use image node_id 5 for calling a global function with example usage: _auto_fill(series) and returns: TimeSeries