defget(func:"UserApp")->"ASGIApp":methods=("GET","HEAD")method_now_allowed_response=_get_method_not_allowed_response(methods)error_response=AsgiResponse(body=b"Internal Server Error",status_code=500)@wraps(func)asyncdefasgi_wrapper(scope:"Scope",receive:"Receive",send:"Send",)->None:ifscope["method"]notinmethods:response:ASGIApp=method_now_allowed_responseelse:try:response=awaitfunc(scope)exceptException:response=error_responseawaitresponse(scope,receive,send)returnreturnasgi_wrapper