code: def _filter_dates(dates, time_difference):
          
  
          LOGGER.debug("dates=%s", dates)
  
          if len(dates) <= 1:
              return dates
  
          sorted_dates = sorted(dates)
  
          separate_dates = [sorted_dates[0]]
          for curr_date in sorted_dates[1:]:
              if curr_date - separate_dates[-1] > time_difference:
                  separate_dates.append(curr_date)
          return separate_dates
docs: Filters out dates within time_difference, preserving only the oldest date.
  
          :param dates: a list of datetime objects
          :param time_difference: a ``datetime.timedelta`` representing the time difference threshold
          :return: an ordered list of datetimes `d1<=d2<=...<=dn` such that `d[i+1]-di > time_difference`
          :rtype: list(datetime.datetime)