def create_user(username, firstname, lastname, email, password_hash, tid, teacher=False,
                background="undefined", country="undefined", receive_ctf_emails=False):

    db = api.common.get_conn()
    uid = api.common.token()

    if safe_fail(get_user, name=username) is not None:
        raise InternalException("User already exists!")

    updated_team = db.teams.find_and_modify(
        query={"tid": tid, "size": {"$lt": api.team.max_team_users}},
        update={"$inc": {"size": 1}},
        new=True)

    if not updated_team:
        raise InternalException("There are too many users on this team!")

    user = {
        'uid': uid,
        'firstname': firstname,
        'lastname': lastname,
        'username': username,
        'email': email,
        'password_hash': password_hash,
        'tid': tid,
        'teacher': teacher,
        'disabled': False,
        'background': background,
        'country': country,
        'receive_ctf_emails': receive_ctf_emails
    }

    db.users.insert(user)

    return uid
A tuple-specific equality assertion.
dataset/ETHPy150Open IceCTF/ctf-platform/api/api/user.py/create_user--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.3/django/utils/unittest/case.py/TestCase.assertTupleEqual