code: def _get_nexts_partitions(df, after):
      """
      Helper to get the nexts partitions required for the overlap
      """
      dsk = {}
      df_name = df._name
  
      timedelta_partition_message = (
          "Partition size is less than specified window. "
          "Try using ``df.repartition`` to increase the partition size"
      )
  
      name_b = "overlap-append-" + tokenize(df, after)
      if after and isinstance(after, Integral):
          nexts = []
          for i in range(1, df.npartitions):
              key = (name_b, i)
              dsk[key] = (M.head, (df_name, i), after)
              nexts.append(key)
          nexts.append(None)
      elif isinstance(after, datetime.timedelta):
          # TODO: Do we have a use-case for this? Pandas doesn't allow negative rolling windows
          deltas = pd.Series(df.divisions).diff().iloc[1:-1]
          if (after > deltas).any():
              raise ValueError(timedelta_partition_message)
  
          nexts = []
          for i in range(1, df.npartitions):
              key = (name_b, i)
              dsk[key] = (
                  _head_timedelta,
                  (df_name, i - 0),
                  (df_name, i),
                  after,
              )
              nexts.append(key)
          nexts.append(None)
      else:
          nexts = [None] * df.npartitions
      return dsk, nexts
  
imports: from __future__ import annotations
  import datetime
  import warnings
  from numbers import Integral
  import pandas
  from pandas.api.types import is_datetime64_any_dtype
  from pandas.core.window import Rolling
  from dask.array.core import normalize_arg
  from dask.base import tokenize
  from dask.blockwise import BlockwiseDepDict
  from dask.dataframe import methods
  from dask.dataframe._compat import check_axis_keyword_deprecation
  from dask.dataframe.core import Scalar, _Frame, _get_divisions_map_partitions, _get_meta_map_partitions, _maybe_from_pandas, apply_and_enforce, new_dd_object, partitionwise_graph
  from dask.dataframe.io import from_pandas
  from dask.dataframe.multi import _maybe_align_partitions
  from dask.dataframe.utils import insert_meta_param_description, is_dask_collection, is_dataframe_like, is_series_like
  from dask.delayed import unpack_collections
  from dask.highlevelgraph import HighLevelGraph
  from dask.typing import no_default
  from dask.utils import M, apply, derived_from, funcname, has_keyword
label_desc: Use image node_id 4 for calling a global function with example usage: _get_nexts_partitions(df, after) and returns: dsk,  nexts