def user_find(client, user, db_name):
 for mongo_user in client['admin'].system.users.find():
  if (mongo_user['user'] == user):
   if ('db' not in mongo_user):
    return mongo_user
   if (mongo_user['db'] == db_name):
    return mongo_user
 return False

def user_find ( client , user , db_name ) : for mongo_user in client [ 'admin' ] . system . users . find ( ) : if ( mongo_user [ 'user' ] == user ) : if ( 'db' not in mongo_user ) : return mongo_user if ( mongo_user [ 'db' ] == db_name ) : return mongo_user return False
check if the user exists .