code: def date_range(
      start=None,
      end=None,
      periods=None,
      freq=None,
      tz=None,
      normalize=False,
      name=None,
      closed=no_default,
      inclusive=None,
      chunk_size=None,
      **kwargs,
  ):
      """
      Return a fixed frequency DatetimeIndex.
  
      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, default 'D'
          Frequency strings can have multiples, e.g. '5H'. See
          :ref:`here <timeseries.offset_aliases>` for a list of
          frequency aliases.
      tz : str or tzinfo, optional
          Time zone name for returning localized DatetimeIndex, for example
          'Asia/Hong_Kong'. By default, the resulting DatetimeIndex is
          timezone-naive.
      normalize : bool, default False
          Normalize start/end dates to midnight before generating date range.
      name : str, default None
          Name of the resulting DatetimeIndex.
      inclusive : {“both”, “neither”, “left”, “right”}, default “both”
          Include boundaries; Whether to set each bound as closed or open.
      **kwargs
          For compatibility. Has no effect on the result.
  
      Returns
      -------
      rng : DatetimeIndex
  
      See Also
      --------
      DatetimeIndex : An immutable container for datetimes.
      timedelta_range : Return a fixed frequency TimedeltaIndex.
      period_range : Return a fixed frequency PeriodIndex.
      interval_range : Return a fixed frequency IntervalIndex.
  
      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).
  
      To learn more about the frequency strings, please see `this link
      <https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases>`__.
  
      Examples
      --------
      **Specifying the values**
  
      The next four examples generate the same `DatetimeIndex`, but vary
      the combination of `start`, `end` and `periods`.
  
      Specify `start` and `end`, with the default daily frequency.
      >>> import mars.dataframe as md
  
      >>> md.date_range(start='1/1/2018', end='1/08/2018').execute()
      DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04',
                     '2018-01-05', '2018-01-06', '2018-01-07', '2018-01-08'],
                    dtype='datetime64[ns]', freq='D')
  
      Specify `start` and `periods`, the number of periods (days).
  
      >>> md.date_range(start='1/1/2018', periods=8).execute()
      DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04',
                     '2018-01-05', '2018-01-06', '2018-01-07', '2018-01-08'],
                    dtype='datetime64[ns]', freq='D')
  
      Specify `end` and `periods`, the number of periods (days).
  
      >>> md.date_range(end='1/1/2018', periods=8).execute()
      DatetimeIndex(['2017-12-25', '2017-12-26', '2017-12-27', '2017-12-28',
                     '2017-12-29', '2017-12-30', '2017-12-31', '2018-01-01'],
                    dtype='datetime64[ns]', freq='D')
  
      Specify `start`, `end`, and `periods`; the frequency is generated
      automatically (linearly spaced).
  
      >>> md.date_range(start='2018-04-24', end='2018-04-27', periods=3).execute()
      DatetimeIndex(['2018-04-24 00:00:00', '2018-04-25 12:00:00',
                     '2018-04-27 00:00:00'],
                    dtype='datetime64[ns]', freq=None)
  
      **Other Parameters**
  
      Changed the `freq` (frequency) to ``'M'`` (month end frequency).
  
      >>> md.date_range(start='1/1/2018', periods=5, freq='M').execute()
      DatetimeIndex(['2018-01-31', '2018-02-28', '2018-03-31', '2018-04-30',
                     '2018-05-31'],
                    dtype='datetime64[ns]', freq='M')
  
      Multiples are allowed
  
      >>> md.date_range(start='1/1/2018', periods=5, freq='3M').execute()
      DatetimeIndex(['2018-01-31', '2018-04-30', '2018-07-31', '2018-10-31',
                     '2019-01-31'],
                    dtype='datetime64[ns]', freq='3M')
  
      `freq` can also be specified as an Offset object.
  
      >>> md.date_range(start='1/1/2018', periods=5, freq=md.offsets.MonthEnd(3)).execute()
      DatetimeIndex(['2018-01-31', '2018-04-30', '2018-07-31', '2018-10-31',
                     '2019-01-31'],
                    dtype='datetime64[ns]', freq='3M')
  
      Specify `tz` to set the timezone.
  
      >>> md.date_range(start='1/1/2018', periods=5, tz='Asia/Tokyo').execute()
      DatetimeIndex(['2018-01-01 00:00:00+09:00', '2018-01-02 00:00:00+09:00',
                     '2018-01-03 00:00:00+09:00', '2018-01-04 00:00:00+09:00',
                     '2018-01-05 00:00:00+09:00'],
                    dtype='datetime64[ns, Asia/Tokyo]', freq='D')
  
      `inclusive` controls whether to include `start` and `end` that are on the
      boundary. The default, "both", includes boundary points on either end.
  
      >>> md.date_range(start='2017-01-01', end='2017-01-04', inclusive='both').execute()
      DatetimeIndex(['2017-01-01', '2017-01-02', '2017-01-03', '2017-01-04'],
                    dtype='datetime64[ns]', freq='D')
  
      Use ``inclusive='left'`` to exclude `end` if it falls on the boundary.
  
      >>> md.date_range(start='2017-01-01', end='2017-01-04', closed='left').execute()
      DatetimeIndex(['2017-01-01', '2017-01-02', '2017-01-03'],
                    dtype='datetime64[ns]', freq='D')
  
      Use ``inclusive='right'`` to exclude `start` if it falls on the boundary,
      and similarly inclusive='neither' will exclude both `start` and `end`.
  
      >>> md.date_range(start='2017-01-01', end='2017-01-04', closed='right').execute()
      DatetimeIndex(['2017-01-02', '2017-01-03', '2017-01-04'],
                    dtype='datetime64[ns]', freq='D')
  
      .. note::
          Pandas 1.4.0 or later is required to use ``inclusive='neither'``.
          Otherwise an error may be raised.
      """
      # validate periods
      if isinstance(periods, (float, np.floating)):
          periods = int(periods)
      if periods is not None and not isinstance(
          periods, (int, np.integer)
      ):
          raise TypeError(f"periods must be a number, got {periods}")
  
      if freq is None and any(
          arg is None for arg in [periods, start, end]
      ):
          freq = "D"
      if (
          sum(arg is not None for arg in [start, end, periods, freq])
          != 3
      ):
          raise ValueError(
              "Of the four parameters: start, end, periods, "
              "and freq, exactly three must be specified"
          )
      freq = to_offset(freq)
  
      if _date_range_use_inclusive and closed is not no_default:
          warnings.warn(
              "Argument `closed` is deprecated in favor of `inclusive`.",
              FutureWarning,
          )
      elif closed is no_default:
          closed = None
  
      if inclusive is None and closed is not no_default:
          inclusive = closed
  
      if start is not None:
          start = pd.Timestamp(start)
  
      if end is not None:
          end = pd.Timestamp(end)
  
      if start is pd.NaT or end is pd.NaT:
          raise ValueError("Neither `start` nor `end` can be NaT")
  
      start, end, _ = _maybe_normalize_endpoints(start, end, normalize)
      tz = _infer_tz_from_endpoints(start, end, tz)
  
      if start is None and end is not None:
          # start is None and end is not None
          # adjust end first
          end = pd.date_range(end=end, periods=1, freq=freq)[0]
          if inclusive == "neither":
              end -= freq
          size = periods
          start = end - (periods - 1) * freq
          if inclusive in ("neither", "left"):
              size -= 1
          elif inclusive == "right":
              # when start is None, closed == 'left' would not take effect
              # thus just ignore
              inclusive = "both"
      elif end is None:
          # end is None
          # adjust start first
          start = pd.date_range(start=start, periods=1, freq=freq)[0]
          size = periods
          end = start + (periods - 1) * freq
          if inclusive in ("neither", "right"):
              size -= 1
          elif inclusive == "left":
              # when end is None, closed == 'left' would not take effect
              # thus just ignore
              inclusive = "both"
      else:
          if periods is None:
              periods = size = generate_range_count(
                  start, end, periods, freq
              )
          else:
              size = periods
          if inclusive in ("left", "right"):
              size -= 1
          elif inclusive == "neither":
              size -= 2
  
      shape = (size,)
      op = DataFrameDateRange(
          start=start,
          end=end,
          periods=periods,
          freq=freq,
          tz=tz,
          normalize=normalize,
          name=name,
          inclusive=inclusive,
          **kwargs,
      )
      return op(shape, chunk_size=chunk_size)
  
imports: import warnings
  from datetime import datetime, date, time
  import numpy
  import pandas
  from pandas import Timestamp, NaT
  from pandas.tseries.frequencies import to_offset
  from pandas.tseries.offsets import Tick
  from pandas._libs.tslibs import timezones
  from ...None import opcodes
  from ...config import options
  from ...core import OutputType
  from ...serialization.serializables import AnyField, Int64Field, BoolField, StringField
  from ...tensor.utils import decide_chunk_sizes
  from ...utils import pd_release_version, no_default
  from ..operands import DataFrameOperand, DataFrameOperandMixin
  from ..utils import parse_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, inclusive, chunk_size) and returns: op