How to get response from microsoft QnA Maker in rasa chatbot?

I migrated my luis to rasa as per mentioned in [Rasa as open source alternative to Microsoft LUIS - Migration Guide][1]. I have a python code which fetches answer from a QnA Maker knowledge base and gives result in json format. Now my work is rasa has to take the result of the python code and give that result as response of the chatbot. How can I do that? Where should I deploy this python code? Below is my python code.

v1 = 'where is germanium'

def conference_room():

    import http.client, urllib.parse, json, time, sys

    host = "newbot.azurewebsites.net"

    endpoint_key = "xxxxxxxx-8xxe-xxxx-9xx2-7cxx4fxxxxx"

    route = "/qnamaker/knowledgebases/xxxx052f-4xxa-xx7d-xxxx-4xxadxxxxxx/generateAnswer"

    q1 = {'question':v1}
    question = str(q1)
    
    headers = {
               'Authorization': 'EndpointKey ' + endpoint_key,
               'Content-Type': 'application/json'
               }
    try:
        conn = http.client.HTTPSConnection(host,port=443)
        conn.request ("POST", route,  question, headers)
        response = conn.getresponse ()
        answer = response.read ()
        print(json.dumps(json.loads(answer), indent=4))
    except :
        print ("Unexpected error:", sys.exc_info()[0])
        print ("Unexpected error:", sys.exc_info()[1])

conference_room()

[1]: Rasa as open source alternative to Microsoft LUIS - Migration GuidePreformatted text

You can implement this as a Actions . Using rasa-sdk, you would need to define an action that executes dispatcher.utter_message(<your formatted output here>) as part of its run method.