<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def is_affected(hazard, classification, hazard_class, qsettings=None):
 """Get affected flag for hazard in classification in hazard class. :param hazard: The hazard key. :type hazard: basestring :param classification: The classification key. :type classification: basestring :param hazard_class: The hazard class key. :type hazard_class: basestring :param qsettings: A custom QSettings to use. If it's not defined, it will use the default one. :type qsettings: qgis.PyQt.QtCore.QSettings :returns: True if it's affected, else False. Default to False. :rtype: bool """

    preference_data = setting(
        'population_preference',
        default=generate_default_profile(),
        qsettings=qsettings)

    # Use default from the default profile
    default_profile = generate_default_profile()
    default_affected_value = default_profile.get(hazard, {}).get(
        classification, {}).get(hazard_class, {}).get(
        'affected', not_exposed_class['key'])
    # noinspection PyUnresolvedReferences
    return preference_data.get(hazard, {}).get(classification, {}).get(
        hazard_class, {}).get('affected', default_affected_value)