code: def shift_dates(dates, start_date, end_date, shift):
      """
      Shift dates of a pipeline query back by ``shift`` days.
  
      Parameters
      ----------
      dates : DatetimeIndex
          All known dates.
      start_date : pd.Timestamp
          Start date of the pipeline query.
      end_date : pd.Timestamp
          End date of the pipeline query.
      shift : int
          The number of days to shift back the query dates.
  
      Returns
      -------
      shifted : pd.DatetimeIndex
          The range [start_date, end_date] from ``dates``, shifted backwards by
          ``shift`` days.
  
      Raises
      ------
      ValueError
          If ``start_date`` or ``end_date`` is not in ``dates``.
      NoFurtherDataError
          If shifting ``start_date`` back by ``shift`` days would push it off the
          end of ``dates``.
      """
      try:
          start = dates.get_loc(start_date)
      except KeyError:
          if start_date < dates[0]:
              raise NoFurtherDataError(
                  msg=(
                      "Pipeline Query requested data starting on {query_start}, "
                      "but first known date is {calendar_start}"
                  ).format(
                      query_start=str(start_date),
                      calendar_start=str(dates[0]),
                  )
              )
          else:
              raise ValueError(
                  "Query start %s not in calendar" % start_date
              )
  
      # Make sure that shifting doesn't push us out of the calendar.
      if start < shift:
          raise NoFurtherDataError(
              msg=(
                  "Pipeline Query requested data from {shift}"
                  " days before {query_start}, but first known date is only "
                  "{start} days earlier."
              ).format(
                  shift=shift, query_start=start_date, start=start
              ),
          )
  
      try:
          end = dates.get_loc(end_date)
      except KeyError:
          if end_date > dates[-1]:
              raise NoFurtherDataError(
                  msg=(
                      "Pipeline Query requesting data up to {query_end}, "
                      "but last known date is {calendar_end}"
                  ).format(
                      query_end=end_date,
                      calendar_end=dates[-1],
                  )
              )
          else:
              raise ValueError(
                  "Query end %s not in calendar" % end_date
              )
  
      return dates[start - shift : end - shift + 1]
  
file_path: zipline/zipline/pipeline/loaders/utils.py
imports: import numpy
  import pandas
  from zipline.errors import NoFurtherDataError
  from zipline.pipeline.common import TS_FIELD_NAME, SID_FIELD_NAME
  from zipline.utils.numpy_utils import categorical_dtype
label_desc: Use image node_id 7 for calling a global function with example usage: shift_dates(dates, start_date, end_date, shift) and returns: dates