code: def filter(self, dates=None, min_dets=1):
          
          if dates is None:
              raise MatchFilterError('Need a list defining a date range')
          new_party = Party()
          for fam in self.families:
              new_fam = Family(
                  template=fam.template,
                  detections=[det for det in fam if
                              dates[0] < det.detect_time < dates[1]])
              if len(new_fam) >= min_dets:
                  new_party.families.append(new_fam)
          return new_party
docs: Return a new Party filtered according to conditions.
  
          Return a new Party with only detections within a date range and
          only families with a minimum number of detections.
  
          :type dates: list of obspy.core.UTCDateTime objects
          :param dates: A start and end date for the new Party
          :type min_dets: int
          :param min_dets: Minimum number of detections per family
  
          .. rubric:: Example
  
          >>> from obspy import UTCDateTime
          >>> Party().read().filter(dates=[UTCDateTime(2016, 1, 1),
          ...                              UTCDateTime(2017, 1, 1)],
          ...                       min_dets=30) # doctest: +SKIP