code: def _convert_datetimes(
      sas_datetimes: pd.Series, unit: str
  ) -> pd.Series:
      """
      Convert to Timestamp if possible, otherwise to datetime.datetime.
      SAS float64 lacks precision for more than ms resolution so the fit
      to datetime.datetime is ok.
  
      Parameters
      ----------
      sas_datetimes : {Series, Sequence[float]}
         Dates or datetimes in SAS
      unit : {str}
         "d" if the floats represent dates, "s" for datetimes
  
      Returns
      -------
      Series
         Series of datetime64 dtype or datetime.datetime.
      """
      try:
          return pd.to_datetime(
              sas_datetimes, unit=unit, origin="1960-01-01"
          )
      except OutOfBoundsDatetime:
          s_series = sas_datetimes.apply(_parse_datetime, unit=unit)
          s_series = cast(pd.Series, s_series)
          return s_series
  
imports: from __future__ import annotations
  from collections import abc
  from datetime import datetime, timedelta
  import sys
  from typing import cast
  import numpy
  from pandas._typing import CompressionOptions, FilePath, ReadBuffer
  from pandas.errors import EmptyDataError, OutOfBoundsDatetime
  import pandas
  from pandas import DataFrame, isna
  from pandas.io.common import get_handle
  from pandas.io.sas._byteswap import read_double_with_byteswap, read_float_with_byteswap, read_uint16_with_byteswap, read_uint32_with_byteswap, read_uint64_with_byteswap
  from pandas.io.sas._sas import Parser, get_subheader_index
  import pandas.io.sas.sas_constants
  from pandas.io.sas.sasreader import ReaderBase
label_desc: Use image node_id 2 for calling a global function with example usage: _convert_datetimes(sas_datetimes, unit) and returns: pd, s_series