def match_item(key, value, item):
    """
    Check if some item matches criteria.
    """
    if isinstance(value, (list, tuple)):
        return any(match_item(key, sub_value, item) for sub_value in value)
    else:
        return key not in item or str(item.get(key)).lower() == str(value).lower()
def match_item ( key , value , item ) : if isinstance ( value , ( list , tuple ) ) : return any ( match_item ( key , sub_value , item ) for sub_value in value ) else : return key not in item or str ( item . get ( key ) ) . lower ( ) == str ( value ) . lower ( )
Check if some item matches criteria.