@@ -0,0 +1,938 @@
+from flask import abort, current_app, request%0Afrom functools import wraps%0Afrom twilio.util import RequestValidator%0A%0Aimport os%0A%0A%0Adef validate_twilio_request(f):%0A    %22%22%22Validates that incoming requests genuinely originated from Twilio%22%22%22%0A    @wraps(f)%0A    def decorated_function(*args, **kwargs):%0A        # Create an instance of the RequestValidator class%0A        validator = RequestValidator(os.environ.get('TWILIO_AUTH_TOKEN'))%0A%0A        # Validate the request using its URL, POST data,%0A        # and X-TWILIO-SIGNATURE header%0A        request_valid = validator.validate(%0A            request.url,%0A            request.form,%0A            request.headers.get('X-TWILIO-SIGNATURE', ''))%0A%0A        # Continue processing the request if it's valid, return a 403 error if%0A        # it's not%0A        if request_valid or current_app.debug:%0A            return f(*args, **kwargs)%0A        else:%0A            return abort(403)%0A    return decorated_function%0A

Add better decorator for testing