code: def write_catalog(detections, fname, format="QUAKEML"):
      
      catalog = get_catalog(detections)
      catalog.write(filename=fname, format=format)
docs: Write events contained within detections to a catalog file.
  
      :type detections: list
      :param detections: list of eqcorrscan.core.match_filter.Detection
      :type fname: str
      :param fname: Name of the file to write to
      :type format: str
      :param format: File format to use, see obspy.core.event.Catalog.write \
          for supported formats.