'Unstage selected files, or all files if no selection exists.'

def unstage(self):

    paths = selection_model().staged
    if (not paths):
        cmds.do(cmds.UnstageAll)
    else:
        cmds.do(cmds.Unstage, paths)
