code: def fill_hazard_class(layer):
      
      hazard_field = layer.keywords['inasafe_fields'][hazard_class_field['key']]
  
      expression = '"%s" is NULL OR  "%s" = \'\'' % (hazard_field, hazard_field)
      index = layer.fields().lookupField(hazard_field)
      request = QgsFeatureRequest().setFilterExpression(expression)
      layer.startEditing()
  
      for feature in layer.getFeatures(request):
          layer.changeAttributeValue(
              feature.id(),
              index,
              not_exposed_class['key'])
      layer.commitChanges()
  
      return layer
docs: We need to fill hazard class when it's empty.
  
      :param layer: The vector layer.
      :type layer: QgsVectorLayer
  
      :return: The updated vector layer.
      :rtype: QgsVectorLayer
  
      .. versionadded:: 4.0