code: def isnat(val):
      
      if (isinstance(val, (np.datetime64, np.timedelta64)) or
          (isinstance(val, np.ndarray) and val.dtype.kind == 'M')):
          if numpy_version >= '1.13':
              return np.isnat(val)
          else:
              return val.view('i8') == nat_as_integer
      elif pd and val is pd.NaT:
          return True
      elif pd and isinstance(val, pandas_datetime_types+pandas_timedelta_types):
          return pd.isna(val)
      else:
          return False
docs: Checks if the value is a NaT. Should only be called on datetimelike objects.