code: def discover():
      res = {}
      try:
          for k in Cache:
              _type = Cache[k]
              rec = {"host": k[0], "port": k[1]}
              if _type not in res:
                  res[_type] = [rec]
              else:
                  res[_type].append(rec)
      except Exception as e:
          return {"error": str(e)}, 500
      return res, 200
  
imports: import os
  import cachetools
  from flask import Flask, request
label_desc: Use image node_id 3 for calling a global function with example usage: discover() and returns: res,  int, dict,  int