code: def _infer_tz_from_endpoints(start, end, tz):  # pragma: no cover
      """
      If a timezone is not explicitly given via `tz`, see if one can
      be inferred from the `start` and `end` endpoints.  If more than one
      of these inputs provides a timezone, require that they all agree.
  
      Parameters
      ----------
      start : Timestamp
      end : Timestamp
      tz : tzinfo or None
  
      Returns
      -------
      tz : tzinfo or None
  
      Raises
      ------
      TypeError : if start and end timezones do not agree
      """
      try:
          inferred_tz = timezones.infer_tzinfo(start, end)
      except AssertionError:
          # infer_tzinfo raises AssertionError if passed mismatched timezones
          raise TypeError(
              "Start and end cannot both be tz-aware with different timezones"
          )
  
      inferred_tz = timezones.maybe_get_tz(inferred_tz)
      tz = timezones.maybe_get_tz(tz)
  
      if tz is not None and inferred_tz is not None:
          if not timezones.tz_compare(inferred_tz, tz):
              raise AssertionError(
                  "Inferred time zone not equal to passed time zone"
              )
  
      elif inferred_tz is not None:
          tz = inferred_tz
  
      return tz
  
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 3 for calling a global function with example usage: _infer_tz_from_endpoints(start, end, tz) and returns: tz