def create_account(create_account_key):
    """Checks the key. If valid, displays the create account page."""
    user_id = auth_utils.check_create_account_key(create_account_key)
    if user_id is None:
        flask.current_app.logger.warn(
            f'Invalid create_account_key: {create_account_key}')
        flask.flash("Invalid request. Please check your link and try again.")
        return flask.redirect(flask.url_for("home"))

    user_data = helpers.get_user_data(user_id)
    if user_data is None:
        flask.flash("An unexpected error occurred. Please contact DevTeam.")
        return flask.redirect(flask.url_for("home"))
    return flask.render_template(
        "create_account.html", user_data=user_data, key=create_account_key)