def insert_achievement(achievement):

    db = api.common.get_conn()
    validate(achievement_schema, achievement)

    achievement["disabled"] = achievement.get("disabled", False)

    achievement["aid"] = api.common.hash(achievement["name"])

    if safe_fail(get_achievement, aid=achievement["aid"]) is not None:
        raise WebException("achievement with identical aid already exists.")


    if safe_fail(get_achievement, name=achievement["name"]) is not None:
        raise WebException("achievement with identical name already exists.")

    db.achievements.insert(achievement)
    api.cache.fast_cache.clear()

    return achievement["aid"]
A tuple-specific equality assertion.
dataset/ETHPy150Open IceCTF/ctf-platform/api/api/achievement.py/insert_achievement--crossover with--dataset/ETHPy150Open JetBrains/python-skeletons/nose/tools/__init__.py/assert_tuple_equal