(
        pending, completed, failed, skipped, all=False, multi=False)
Helper function to that raises UserWarning if user's request defines
    an invalid combination of job states
Helper function to that raises UserWarning if user's request defines
    an invalid combination of job states
Helper function to that raises UserWarning if user s request defines an invalid combination of job states
def validate_state(
        pending, completed, failed, skipped, all=False, multi=False):
    """Helper function to that raises UserWarning if user's request defines
    an invalid combination of job states
    """
    cnt = pending + completed + failed + skipped
    if multi:
        if cnt < 1 and not all:
            raise UserWarning(
                "you must request at least one of these states:"
                " pending, completed, failed, skipped")
    else:
        if cnt != 1:
            raise UserWarning(
                "you must request exactly one of these states:"
                " pending, completed, failed, skipped")
    rv = []
    if all or pending:
        rv.append(shared.PENDING)
    if all or completed:
        rv.append(shared.COMPLETED)
    if all or failed:
        rv.append(shared.FAILED)
    if all or skipped:
        rv.append(shared.SKIPPED)
    if multi:
        return rv
    else:
        return rv[0]
def validate_state ( pending , completed , failed , skipped , all = False , multi = False ) : cnt = pending + completed + failed + skipped if multi : if cnt < 1 and not all : raise UserWarning ( "you must request at least one of these states:" " pending, completed, failed, skipped" ) else : if cnt != 1 : raise UserWarning ( "you must request exactly one of these states:" " pending, completed, failed, skipped" ) rv = [ ] if all or pending : rv . append ( shared . PENDING ) if all or completed : rv . append ( shared . COMPLETED ) if all or failed : rv . append ( shared . FAILED ) if all or skipped : rv . append ( shared . SKIPPED ) if multi : return rv else : return rv [ 0 ]