def getTimeline(ifd):
    """Get the TIMELINE extension (if there is one) from the input file.

    Parameters
    ----------
    ifd: pyfits HDUList object
        The pyfits file handle for the input file.

    Returns
    -------
    pyfits BinTableHDU object, or None
        The TIMELINE extension from the input file, if there is one.
    """
    hdunum = 0
    for i in range(1, len(ifd)):
        hdu = ifd[i]
        extname = hdu.header.get('extname', 'MISSING')
        if extname.upper() == 'TIMELINE':
            hdunum = i
            break
    if hdunum < 1:
        timeline_hdu = None
    else:
        timeline_hdu = ifd[hdunum]
        if timeline_hdu.data is None:
            timeline_hdu = None
    return timeline_hdu
