def find_d2ifile(flist,detector):
    """ Search a list of files for one that matches the detector specified.
    """
    d2ifile = None
    for f in flist:
        fdet = fits.getval(f, 'detector', memmap=False)
        if fdet == detector:
            d2ifile = f
    return d2ifile
Search a list of files for one that matches the detector specified.