code: def date_range(
      start=None,
      end=None,
      periods=None,
      freq=None,
      tz=None,
      normalize=False,
      name=None,
      closed=None,
  ):
      """Return a fixed frequency DatetimeIndex.
  
      Returns the range of equally spaced time points (where the difference
      between any two adjacent points is specified by the given frequency)
      such that they all satisfy `start` <[=] x <[=] `end`, where the first one
      and the last one are, resp., the first and last time points in that range
      that are valid for `freq`.
  
      Parameters
      ----------
      start : str or datetime-like, optional
          Left bound for generating dates.
  
      end : str or datetime-like, optional
          Right bound for generating dates.
  
      periods : int, optional
          Number of periods to generate.
  
      freq : str or DateOffset
          Frequencies to generate the datetime series. Mixed fixed-frequency and
          non-fixed frequency offset is unsupported. See notes for detail.
          Supported offset alias: ``D``, ``h``, ``H``, ``T``, ``min``, ``S``,
          ``U``, ``us``, ``N``, ``ns``.
  
      tz : str or tzinfo, optional
          Not Supported
  
      normalize : bool, default False
          Not Supported
  
      name : str, default None
          Name of the resulting DatetimeIndex
  
      closed : {None, 'left', 'right'}, optional
          Not Supported
  
      Returns
      -------
      DatetimeIndex
  
      Notes
      -----
      Of the four parameters `start`, `end`, `periods`, and `freq`, exactly three
      must be specified. If `freq` is omitted, the resulting DatetimeIndex will
      have periods linearly spaced elements between start and end (closed on both
      sides).
  
      cudf supports `freq` specified with either fixed-frequency offset
      (such as weeks, days, hours, minutes...) or non-fixed frequency offset
      (such as years and months). Specifying `freq` with a mixed fixed and
      non-fixed frequency is currently unsupported. For example:
  
      >>> cudf.date_range(
      ...     start='2021-08-23 08:00:00',
      ...     freq=cudf.DateOffset(months=2, days=5),
      ...     periods=5)
      ...
      NotImplementedError: Mixing fixed and non-fixed frequency offset is
      unsupported.
  
      Examples
      --------
      >>> cudf.date_range(
      ...     start='2021-08-23 08:00:00',
      ...     freq=cudf.DateOffset(years=1, months=2),
      ...     periods=5)
      DatetimeIndex(['2021-08-23 08:00:00', '2022-10-23 08:00:00',
                  '2023-12-23 08:00:00', '2025-02-23 08:00:00',
                  '2026-04-23 08:00:00'],
                  dtype='datetime64[ns]')
  
      """
      if tz is not None:
          raise NotImplementedError("tz is currently unsupported.")
  
      if closed is not None:
          raise NotImplementedError("closed is currently unsupported.")
  
      if (start, end, periods, freq).count(None) > 1:
          raise ValueError(
              "Of the four parameters: start, end, periods, and freq, exactly "
              "three must be specified"
          )
  
      dtype = np.dtype("<M8[ns]")
  
      if freq is None:
          # `start`, `end`, `periods` is specified, we treat the timestamps as
          # integers and divide the number range evenly with `periods` elements.
          start = cudf.Scalar(start, dtype=dtype).value.astype("int64")
          end = cudf.Scalar(end, dtype=dtype).value.astype("int64")
          arr = cp.linspace(start=start, stop=end, num=periods)
          result = cudf.core.column.as_column(arr).astype(
              "datetime64[ns]"
          )
          return cudf.DatetimeIndex._from_data({name: result})
  
      # The code logic below assumes `freq` is defined. It is first normalized
      # into `DateOffset` for further computation with timestamps.
  
      if isinstance(freq, DateOffset):
          offset = freq
      elif isinstance(freq, str):
          offset = pd.tseries.frequencies.to_offset(freq)
          if not isinstance(
              offset, pd.tseries.offsets.Tick
          ) and not isinstance(offset, pd.tseries.offsets.Week):
              raise ValueError(
                  f"Unrecognized frequency string {freq}. cuDF does "
                  "not yet support month, quarter, year-anchored frequency."
              )
          offset = DateOffset._from_pandas_ticks_or_weeks(offset)
      else:
          raise TypeError(
              "`freq` must be a `str` or cudf.DateOffset object."
          )
  
      if _has_mixed_freqeuency(offset):
          raise NotImplementedError(
              "Mixing fixed and non-fixed frequency offset is unsupported."
          )
  
      # Depending on different combinations of `start`, `end`, `offset`,
      # `periods`, the following logic makes sure before computing the sequence,
      # `start`, `periods`, `offset` is defined
  
      _periods_not_specified = False
  
      if start is None:
          end = cudf.Scalar(end, dtype=dtype)
          start = cudf.Scalar(
              pd.Timestamp(end.value)
              - (periods - 1) * offset._maybe_as_fast_pandas_offset(),
              dtype=dtype,
          )
      elif end is None:
          start = cudf.Scalar(start, dtype=dtype)
      elif periods is None:
          # When `periods` is unspecified, its upper bound estimated by
          # dividing the number of nanoseconds between two timestamps with
          # the lower bound of `freq` in nanoseconds. While the final result
          # may contain extra elements that exceeds `end`, they are trimmed
          # as a post processing step. [1]
          _periods_not_specified = True
          start = cudf.Scalar(start, dtype=dtype)
          end = cudf.Scalar(end, dtype=dtype)
          _is_increment_sequence = end >= start
  
          periods = math.ceil(
              int(end - start)
              / _offset_to_nanoseconds_lower_bound(offset)
          )
  
          if periods < 0:
              # Mismatched sign between (end-start) and offset, return empty
              # column
              periods = 0
          elif periods == 0:
              # end == start, return exactly 1 timestamp (start)
              periods = 1
  
      # We compute `end_estim` (the estimated upper bound of the date
      # range) below, but don't always use it.  We do this to ensure
      # that the appropriate OverflowError is raised by Pandas in case
      # of overflow.
      # FIXME: when `end_estim` is out of bound, but the actual `end` is not,
      # we shouldn't raise but compute the sequence as is. The trailing overflow
      # part should get trimmed at the end.
      end_estim = (
          pd.Timestamp(start.value)
          + periods * offset._maybe_as_fast_pandas_offset()
      ).to_datetime64()
  
      if "months" in offset.kwds or "years" in offset.kwds:
          # If `offset` is non-fixed frequency, resort to libcudf.
          res = libcudf.datetime.date_range(
              start.device_value, periods, offset
          )
          if _periods_not_specified:
              # As mentioned in [1], this is a post processing step to trim extra
              # elements when `periods` is an estimated value. Only offset
              # specified with non fixed frequencies requires trimming.
              res = res.apply_boolean_mask(
                  (res <= end)
                  if _is_increment_sequence
                  else (res <= start)
              )
      else:
          # If `offset` is fixed frequency, we generate a range of
          # treating `start`, `stop` and `step` as ints:
          stop = end_estim.astype("int64")
          start = start.value.astype("int64")
          step = _offset_to_nanoseconds_lower_bound(offset)
          arr = cp.arange(
              start=start, stop=stop, step=step, dtype="int64"
          )
          res = cudf.core.column.as_column(arr).astype("datetime64[ns]")
  
      return cudf.DatetimeIndex._from_data({name: res}, freq=freq)
  
imports: import math
  import re
  import warnings
  from typing import Sequence, Union
  import cupy
  import numpy
  import pandas
  import pandas.tseries.offsets
  from pandas.core.tools.datetimes import _unit_map
  from typing_extensions import Self
  import cudf
  from cudf import _lib
  from cudf._lib.strings.convert.convert_integers import is_integer
  from cudf.api.types import is_integer, is_scalar
  from cudf.core import column
  from cudf.core.index import as_index
label_desc: Use image node_id 5 for calling a global function with example usage: date_range(start, end, periods, freq, tz, normalize, name, closed) and returns: cudf, cudf