def warranty_generator(serials):
    # One or more arguments can be passed.
    # The arguments can be a single string or a sequence of strings
    for serial in serials:
        if not isinstance(serial, str):
        # if (not hasattr(serial, "strip") and hasattr(serial, "__getitem__") or hasattr(serial, "__iter__")):
            # Iterable, but not a string - recurse using items of the sequence as individual arguments
            for result in warranty_generator(*serial):
                yield result
        else:
            # Assume string and continue
            prod_dict = blank_machine_dict()
            prod_dict['SERIAL_ID'] = serial
            try:
                prod_descr = offline_snippet_lookup(prod_dict['SERIAL_ID'])
            except:
                prod_descr = None
            if (not prod_descr):
                # It's not in the snippet database, look it up
                try:
                    prod_descr = online_snippet_lookup(prod_dict['SERIAL_ID'])
                except:
                    prod_descr = None
            if (not prod_descr):
                prod_dict[u'ERROR_CODE'] = 'Unknown model snippet'
            try:
                prod_dict[u'PROD_DESCR'] = '' + prod_descr
            except:
                prod_dict[u'PROD_DESCR'] = ''
            # Fill in some details with estimations
            try:
                prod_dict[u'EST_MANUFACTURE_DATE'] = offline_estimated_manufacture(serial)
            except:
                prod_dict[u'EST_MANUFACTURE_DATE'] = u''
            if (prod_dict[u'EST_MANUFACTURE_DATE']):
                # Try to estimate when coverages expire
                prod_dict[u'EST_PURCHASE_DATE'] = u'' + prod_dict[u'EST_MANUFACTURE_DATE']
                prod_dict[u'EST_WARRANTY_END_DATE'] = offline_estimated_warranty_end_date(prod_dict)
                prod_dict[u'EST_APPLECARE_END_DATE'] = offline_estimated_applecare_end_date(prod_dict)
                if (dateutil.parser.parse(prod_dict[u'EST_APPLECARE_END_DATE']) > datetime.datetime.now()):
                    prod_dict[u'EST_WARRANTY_STATUS'] = u'EXPIRED'
                elif (datetime.datetime.now() > dateutil.parser.parse(prod_dict[u'EST_WARRANTY_END_DATE'])):
                    prod_dict[u'EST_WARRANTY_STATUS'] = u'APPLECARE'
                else:
                    prod_dict[u'EST_WARRANTY_STATUS'] = u'LIMITED'
            yield prod_dict
dataset/ETHPy150Open cwolfram/inge/lib/getwarranty.py/warranty_generator/swapped operands of `>`