input: Write a function to create a Python Flask app that listens for POST requests on the '/webhook' route. When a request is received, the app should extract the necessary parameters from the request and call the 'makeWebhookResult' function to generate a response. The response should be a JSON object containing a 'speech' field with the text to be spoken by the voice assistant. The app should be started on port 5000 and run in debug mode.
  
  
  import requests
  import urllib2
  import json
  import os
  from flask import Flask
  from flask import request
  from flask import make_response
  from bs4 import BeautifulSoup 
  
  # Flask app should start in global layout
  app = Flask(__name__)
  
  @app.route('/webhook', methods=['POST'])
  def webhook():
      req = request.get_json(silent=True, force=True)
      res = makeWebhookResult(req)
      res = json.dumps(res, indent=4)
      print(res)
      r = make_response(res)
      r.headers['Content-Type'] = 'application/json'
      return r
  
  def makeWebhookResult(req):
      result = req.get("result")
      parameters = result.get("parameters")
      
      if req.get("result").get("action") == "productos.sura":
          cliente = parameters.get("tipo_cliente")
          speech = "Buscando productos para " + cliente
          
      elif req.get("result").get("action") == "producto.info":
          producto = parameters.get("producto")
          if (producto=="hogar"):
              url = "https://www.sura.com/soluciones-personas/seguro-hogar.aspx"
              r = urllib2.urlopen(url).read()
              soup = BeautifulSoup(r, 'html.parser')
              print soup
              contenido = soup.find_all("div",class_="textRightColumn")
              if (len(contenido)==0):
                  speech = "No encontrado"
              else:
                  speech = contenido[0]
              
          else:
              speech = "Buscando informacion del producto " + producto
          
      elif req.get("result").get("action") == "planes.salud":
          url = "https://api.segurossura.com.co/public/v1/directory/products"
          myResponse = requests.get(url)
  
          if(myResponse.ok):
              jData = json.loads(myResponse.text)
              
          speech = "Seguros Sura Colombia ofrece los siguientes planes de salud: \n"
          
          for plan in jData:
              speech = speech + "\n" + plan["nombreField"].title()
              
      elif req.get("result").get("action") == "info.especialistas":
          producto = parameters.get("plan-salud")
          ciudad = parameters.get("ciudad")
          especialidad = parameters.get("especialidad")
          
          url = "https://api.segurossura.com.co/public/v1/directory/search/" + producto + "/" + ciudad + "?speciality=" + especialidad + "&firstname=&secondname=&firstlastname=&secondlastname="
          myResponse = requests.get(url)
  
          if(myResponse.ok):
              jData = json.loads(myResponse.text)
          
          speech = "Los profesionales que coinciden con tu busqueda son: \n"
  
          for medico in jData:
              speech = speech + "\n" + medico["nombreField"] + "\n Direccion: " + medico["direccionField"].title() + "\n Telefono: " + medico["telefonoField"] + "\n"
              
      elif req.get("result").get("action") == "coberturas.producto":
          producto = parameters.get("productos")
          speech = "Buscando coberturas del producto: " + producto
      else:
          speech =" "
  
      return {
          "speech": speech,
          "displayText": speech,
          #"data": {},
          # "contextOut": [],
          "source": "apiai-onlinestore-shipping"
      }
  
  if __name__ == '__main__':
      port = int(os.getenv('PORT', 5000))
      print "Starting app on port %d" % port
      app.run(debug=True, port=port, host='0.0.0.0')
  
  
  assert makeWebhookResult({"result":{"action":"productos.sura", "parameters":{"tipo_cliente":"VIP"}}})=={"speech":"Buscando productos para VIP", "displayText":"Buscando productos para VIP", "source":"apiai-onlinestore-shipping"}
  assert makeWebhookResult({"result":{"action":"producto.info", "parameters":{"producto":"hogar"}}})=={"speech":"No encontrado", "displayText":"No encontrado", "source":"apiai-onlinestore-shipping"}
  assert makeWebhookResult({"result":{"action":"planes.salud"}})=={"speech":"Seguros Sura Colombia ofrece los siguientes planes de salud: \nPlan Basico\nPlan Premium", "displayText":"Seguros Sura Colombia ofrece los siguientes planes de salud: \nPlan Basico\nPlan Premium", "source":"apiai-onlinestore-shipping"}
  assert makeWebhookResult({})=={"speech":"", "displayText":"", "source":"apiai-onlinestore-shipping"}
output: @app.route('/webhook', methods=['POST'])
  def webhook():
      req = request.get_json(silent=True, force=True)
      res = makeWebhookResult(req)
      res = json.dumps(res, indent=4)
      r = make_response(res)
      r.headers['Content-Type'] = 'application/json'
      return r