code: def _write_family(family, filename):
      
      with open(filename, 'w') as f:
          for detection in family.detections:
              det_str = ''
              for key in detection.__dict__.keys():
                  if key == 'event' and detection.__dict__[key] is not None:
                      value = str(detection.event.resource_id)
                  elif key in ['threshold', 'detect_val', 'threshold_input']:
                      value = format(detection.__dict__[key], '.32f').rstrip('0')
                  else:
                      value = str(detection.__dict__[key])
                  det_str += key + ': ' + value + '; '
              f.write(det_str + '\n')
      return
docs: Write a family to a csv file.
  
      :type family: :class:`eqcorrscan.core.match_filter.Family`
      :param family: Family to write to file
      :type filename: str
      :param filename: File to write to.