code: def layer_definition_type(layer):
      
      layer_purposes = ['exposure', 'hazard']
  
      layer_purpose = [p for p in layer_purposes if p in layer.keywords]
  
      if not layer_purpose:
          return None
  
      layer_purpose = layer_purpose[0]
  
      return definition(layer.keywords[layer_purpose])
docs: Returned relevant layer definition based on layer purpose.
  
      Returned the the correct definition of layer based on its purpose.
      For example, if a layer have layer_purpose: exposure, and exposure: roads
      then it will return definition for exposure_roads.
  
      That's why it only supports hazard layer or exposure layer.
  
      :param layer: hazard layer or exposure layer
      :type layer: qgis.core.QgsVectorLayer
  
      :return: Layer definitions.
      :rtype: dict
  
      .. versionadded:: 4.0