def get_bafa_subs_hp(q_nom, spf):
    """
    BAFA subsidy for a/w heat pumps with nominal power <= 100 kW and spf >= 3.5

    heat pump must be used for:
        - combined space heating and dhw
        - only space heating if dhw is generated with renewable energy
        - generating heat for lhn

    Values only for retrofit; subsidy for new buildings is lower (not implemented)

    Parameters
    ----------
    q_nom : thermal nominal power of heat pump in kW
    spf : seasonal performance factor ("Jahresarbeitszahl")

    Returns
    -------
    subs : amount of subsidy
    """
    subs = 0

    # innovation subsidy
    if q_nom <= 100 and spf >= 4.5:
        if q_nom < 32.5:
            subs = 1950
        else:
            subs = 60*q_nom

    # base subsidy
    if q_nom <= 100 and spf >= 3.5:
        if q_nom < 32.5:
            subs = 1300
        else:
            subs = 40*q_nom

    return subs