def extract_dark(prihdr, scihdu):
if prihdr.get('<STR_LIT>', '<STR_LIT>') == '<STR_LIT>':<EOL><INDENT>darkfile = prihdr.get('<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>darkfile = prihdr.get('<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>if darkfile == '<STR_LIT>':<EOL><INDENT>return None<EOL><DEDENT>darkfile = from_irafpath(darkfile)<EOL>ampstring = prihdr['<STR_LIT>']<EOL>exptime = prihdr.get('<STR_LIT>', <NUM_LIT:0.0>)<EOL>flashdur = prihdr.get('<STR_LIT>', <NUM_LIT:0.0>)<EOL>darktime = exptime + flashdur<EOL>if exptime > <NUM_LIT:0>:  <EOL><INDENT>darktime += <NUM_LIT><EOL><DEDENT>with fits.open(darkfile) as hdudark:<EOL><INDENT>if ampstring == '<STR_LIT>':<EOL><INDENT>dark = np.concatenate(<EOL>(hdudark['<STR_LIT>', <NUM_LIT:1>].data,<EOL>hdudark['<STR_LIT>', <NUM_LIT:2>].data[::-<NUM_LIT:1>, :]), axis=<NUM_LIT:1>)<EOL><DEDENT>elif ampstring in ('<STR_LIT:A>', '<STR_LIT:B>', '<STR_LIT>'):<EOL><INDENT>dark = extract_ref(scihdu, hdudark['<STR_LIT>', <NUM_LIT:2>])<EOL><DEDENT>else:<EOL><INDENT>dark = extract_ref(scihdu, hdudark['<STR_LIT>', <NUM_LIT:1>])<EOL><DEDENT><DEDENT>dark = dark * darktime<EOL>return dark<EOL>
Extract superdark data from ``DARKFILE`` or ``DRKCFILE``.

    Parameters
    ----------
    prihdr : obj
        FITS primary header HDU.

    scihdu : obj
        Extension HDU of the science image.
        This is only used to extract subarray data.

    Returns
    -------
    dark : ndarray or `None`
        Superdark, if any. Subtract this to apply ``DARKCORR``.