<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def user_exists(name, user=None, password=None, host=None, port=None,
                database='admin', authdb=None):
    '''
    Checks if a user exists in MongoDB

    CLI Example:

    .. code-block:: bash

        salt '*' mongodb.user_exists <name> <user> <password> <host> <port> <database>
    '''
    users = user_list(user, password, host, port, database, authdb)

    if isinstance(users, six.string_types):
        return 'Failed to connect to mongo database'

    for user in users:
        if name == dict(user).get('user'):
            return True

    return False