<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _format_label( hazard_class, value, exposure_unit, hazard_unit=None, minimum=None, maximum=None):
 """Helper function to format the label in the legend. :param hazard_class: The main name of the label. :type hazard_class: basestring :param value: The number of features affected by this hazard class. :type value: float :param exposure_unit: The exposure unit. :type exposure_unit: basestring :param hazard_unit: The hazard unit. It can be null if there isn't thresholds. :type hazard_unit: basestring :param minimum: The minimum value used in the threshold. It can be null. :type minimum: float :param maximum: The maximum value used in the threshold. It can be null. :type maximum: float :return: The formatted label. :rtype: basestring """


    # If the exposure unit is not null, we need to add a space.
    if exposure_unit != '':
        exposure_unit = ' %s' % exposure_unit

    if minimum is None and maximum is None:
        label = template_without_thresholds.format(
            name=hazard_class,
            count=value,
            exposure_unit=exposure_unit)
    elif minimum is not None and maximum is None:
        label = template_with_minimum_thresholds.format(
            name=hazard_class,
            count=value,
            exposure_unit=exposure_unit,
            min=minimum,
            hazard_unit=hazard_unit)
    elif minimum is None and maximum is not None:
        label = template_with_maximum_thresholds.format(
            name=hazard_class,
            count=value,
            exposure_unit=exposure_unit,
            max=maximum,
            hazard_unit=hazard_unit)
    else:
        label = template_with_range_thresholds.format(
            name=hazard_class,
            count=value,
            exposure_unit=exposure_unit,
            min=minimum,
            max=maximum,
            hazard_unit=hazard_unit)

    return label