I know this is ancient but just in case there's anyone out there trying to do the same thing, this method will do exactly what you want and update it in the interface also:
from maya import mel
def set_layer_visibility(layer: str = "", visibility: bool = True):
c = f'setDisplayLayerVisibility("{layer}", {int(visibility)})'
mel.eval(c)
You use it like:
set_layer_visibility(layer="YourLayerName", visibility=True)