Python : hide layers in detail and zoom to remaining objects

Hallo, I´m trying to write a function in python that hides all layers in a detail but some and zoom the detail to extend in the remaining objects. Since I do not find any method in rhinoscriptsyntax and am not really fond of rhinocommand, I am trying using rs.Command(), unsuccesfully. What am I doing wrong?

def detailLayersVisibile(detail_id,layers):
# select detail
rs.UnselectAllObjects()
rs.SelectObject(detail_id)
rs.Command('-Detail Enable ', echo=False)
rs.UnselectAllObjects()

#all layers in doc
L_all = rs.LayerNames()

#cycle through layers
for layer in L_all:
    if not(layer in layers):
        commandHide = "_HideLayersInDetail Layers "+layer
        rs.Command(commandHide)

return rs.ZoomExtents()

commandHide = "-HideLayersInDetail Layers " + "\"" + layer + "\" "

try this
you layer names may have spaces in them so need the quotes around them
also the “-” instead of “_” would suppress UI popups