code: def mmi_ramp_roman(raster_layer):
      
  
      items = []
      sorted_mmi_scale = sorted(
          earthquake_mmi_scale['classes'], key=itemgetter('value'))
      for class_max in sorted_mmi_scale:
          colour = class_max['color']
          label = '%s' % class_max['key']
          ramp_item = QgsColorRampShader.ColorRampItem(
              class_max['value'], colour, label)
          items.append(ramp_item)
  
      raster_shader = QgsRasterShader()
      ramp_shader = QgsColorRampShader()
      ramp_shader.setColorRampType(QgsColorRampShader.Interpolated)
      ramp_shader.setColorRampItemList(items)
      raster_shader.setRasterShaderFunction(ramp_shader)
      band = 1
      renderer = QgsSingleBandPseudoColorRenderer(
          raster_layer.dataProvider(),
          band,
          raster_shader)
      raster_layer.setRenderer(renderer)
docs: Generate an mmi ramp using range of 1-10 on roman.
  
      A standarised range is used so that two shakemaps of different
      intensities can be properly compared visually with colours stretched
      accross the same range.
  
      The colours used are the 'standard' colours commonly shown for the
      mercalli scale e.g. on wikipedia and other sources.
  
      :param raster_layer: A raster layer that will have an mmi style applied.
      :type raster_layer: QgsRasterLayer
  
      .. versionadded:: 4.0