Check if some item matches criteria.

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()