def user_exists(username, **kwargs):
    '''
    Find if an user exists in a specific database on the MS SQL server.

    Note:
        *database* argument is mandatory

    CLI Example:

    .. code-block:: bash

        salt minion mssql.user_exists 'USERNAME' [database='DBNAME']
    '''
    # 'database' argument is mandatory
    if kwargs not in 'database':
        return False

    # We should get one, and only one row
    return len(tsql_query(query="SELECT name FROM sysusers WHERE name='{0}'".format(username), **kwargs)) == 1
dataset/ETHPy150Open saltstack/salt/salt/modules/mssql.py/user_exists/swapped operands of `not in`