code: def layer_from_combo(combo):
      
      index = combo.currentIndex()
      if index < 0:
          return None
  
      layer_id = combo.itemData(index, Qt.UserRole)
      layer = QgsProject.instance().mapLayer(layer_id)
      return layer
docs: Get the QgsMapLayer currently selected in a combo.
  
      Obtain QgsMapLayer id from the userrole of the QtCombo and return it as a
      QgsMapLayer.
  
      :returns: The currently selected map layer a combo.
      :rtype: QgsMapLayer