code: def preserve_selection():
      
      sl = cmds.ls(sl=True)
      try:
          yield
      finally:
          cmds.select(sl, replace=True)
docs: Contextmanager that will restore the current selection
  
      :returns: None
      :rtype: None
      :raises: None