def METHOD_NAME(self, request):
    error = None
    url = ""
    if request.method == "POST":
        url = request.form["url"]
        if not is_valid_url(url):
            error = "Please enter a valid URL"
        else:
            short_id = self.insert_url(url)
            return redirect(f"/{short_id}+")
    return self.render_template("new_url.html", error=error, url=url)