def _get_category_state(export, category):
    """Calculates the state for given category for given export.
    """
    selected_products = export.products.all()

    found = False
    not_found = False

    for product in category.get_all_products():
        if product in selected_products:
            found = True
        else:
            not_found = True

    if found and not_found:
        checked = True
        klass = "half"
    elif found:
        checked = True
        klass = "full"
    else:
        checked = False
        klass = ""

    return (checked, klass)
dataset/ETHPy150Open diefenbach/django-lfs/lfs/manage/views/export.py/_get_category_state/original