def error_checks(fn_handles, ref_map, warn):
    """
    Error checks footnote references and the link def reference list...
        - ensure every footnote references an existing item in the ref list
        - ensure every ref list item is referenced by at least one footnote
    """
    ref_handles = set(ref_map.keys())
    missing_refs = fn_handles - ref_handles
    if missing_refs:
        print("Some footnotes never appear in the references...")
        print([x for x in missing_refs])
        if not warn:
            print("Correct above issues and re-try...")
            exit(1)

    missing_fns = ref_handles - fn_handles
    if missing_fns:
        print("Some references never appear in a footnote...")
        print([x for x in missing_fns])
        if not warn:
            print("Correct above issues and re-try...")
            exit(1)

    return missing_fns