code: def api(f):
      
      def wraps(self, *args, **kwargs):
          try:
              return f(self, *args, **kwargs)
          except Exception as e:
              logging.exception(e)
              return json_error_response(get_error_msg())
  
      return functools.update_wrapper(wraps, f)
docs: A decorator to label an endpoint as an API. Catches uncaught exceptions and
      return the response in the JSON format