code: def dt_cluster(dt_list, dt_thresh=16.0):
      
      if not isinstance(dt_list[0], float):
          o_list = dt2o(dt_list)
      else:
          o_list = dt_list
      o_list_sort = np.sort(o_list)
      o_list_sort_idx = np.argsort(o_list)
      d = np.diff(o_list_sort)
      #These are indices of breaks
      #Add one so each b starts a cluster
      b = np.nonzero(d > dt_thresh)[0] + 1 
      #Add one to shape so we include final index
      b = np.hstack((0, b, d.shape[0] + 1))
      f_list = []
      for i in range(len(b)-1):
          #Need to subtract 1 here to give cluster bounds
          b_idx = [b[i], b[i+1]-1]
          b_dt = o_list_sort[b_idx]
          #These should be identical if input is already sorted
          b_idx_orig = o_list_sort_idx[b_idx]
          all_idx = np.arange(b_idx[0], b_idx[1])
          all_sort = o_list_sort[all_idx]
          #These should be identical if input is already sorted
          all_idx_orig = o_list_sort_idx[all_idx] 
          dict = {}
          dict['break_indices'] = b_idx_orig 
          dict['break_ts_o'] = b_dt 
          dict['break_ts_dt'] = o2dt(b_dt) 
          dict['all_indices'] = all_idx_orig
          dict['all_ts_o'] = all_sort
          dict['all_ts_dt'] = o2dt(all_sort)
          f_list.append(dict)
      return f_list
docs: Find clusters of similar datetimes within datetime list