code: def error(code, message, template):
      
      if json_requested():
          return json_error(code, message)
      else:
          return render_template(template, message=message), code
docs: A generic error handler