def _write_family(family, filename):
with open(filename, '<STR_LIT:w>') as f:<EOL><INDENT>for detection in family.detections:<EOL><INDENT>det_str = '<STR_LIT>'<EOL>for key in detection.__dict__.keys():<EOL><INDENT>if key == '<STR_LIT>' and detection.__dict__[key] is not None:<EOL><INDENT>value = str(detection.event.resource_id)<EOL><DEDENT>elif key in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>value = format(detection.__dict__[key], '<STR_LIT>').rstrip('<STR_LIT:0>')<EOL><DEDENT>else:<EOL><INDENT>value = str(detection.__dict__[key])<EOL><DEDENT>det_str += key + '<STR_LIT>' + value + '<STR_LIT>'<EOL><DEDENT>f.write(det_str + '<STR_LIT:\n>')<EOL><DEDENT><DEDENT>return<EOL>
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.