def fetch_adapter_firmware(ipmicmd, certverify):
    adapterdata = None
    try:
        vintage = ipmicmd.ipmi_session.lenovo_cached_adapters[1]
        if vintage > _monotonic_time() - 30:
            adapterdata = ipmicmd.ipmi_session.lenovo_cached_adapters[0]
    except AttributeError:
        pass
    if not adapterdata:
        wc = get_imm_webclient(ipmicmd.bmc, certverify,
                               ipmicmd.ipmi_session.userid,
                               ipmicmd.ipmi_session.password)
        if not wc:
            return
        wc.request('GET', '/designs/imm/dataproviders/imm_adapters.php')
        rsp = wc.getresponse()
        if rsp.status == 200:
            adapterdata = json.loads(rsp.read())
            ipmicmd.ipmi_session.lenovo_cached_adapters = (adapterdata,
                                                           _monotonic_time())
        wc.request('GET', '/data/logout')
    if adapterdata:
        for adata in adapterdata['items']:
            aname = adata['adapter.adapterName']
            donenames = set([])
            for fundata in adata['adapter.functions']:
                fdata = fundata.get('firmwares', ())
                for firm in fdata:
                    fname = firm['firmwareName']
                    if '.' in fname:
                        fname = firm['description']
                    if fname in donenames:
                        # ignore redundant entry
                        continue
                    donenames.add(fname)
                    bdata = {}
                    bdata['version'] = firm['versionStr']
                    if 'releaseDate' in firm and firm['releaseDate'] != 'N/A':
                        bdata['date'] = datetime.strptime(firm['releaseDate'],
                                                          '%m/%d/%Y')
                    yield ('{0} {1}'.format(aname, fname), bdata)
dataset/ETHPy150Open openstack/pyghmi/pyghmi/ipmi/oem/lenovo/imm.py/fetch_adapter_firmware/original