def _get_reffile(hdr, key):
    """Get ref file from given key in given FITS header."""
    ref_file = None
    if key in hdr:
        ref_file = hdr[key].strip()
        if ref_file.upper() == 'N/A':
            ref_file = None
    return ref_file
