<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_layer_visible(layer, visible):
 """Sets a layer in the project visible or not :param layer: layer to change :type layer: QgsMapLayer :param visible: True to show layer, False to hide layer :type visible: bool """

        if layer is None:
            return

        QgsProject.instance().layerTreeRoot().findLayer(
            layer.id()).setItemVisibilityChecked(visible)