code: def rest(f):
      
  
      @wraps(f)
      def wrapper(*args, **kwargs):
          ret = f(*args, **kwargs)
          if ret is None:
              response = '', 204
          elif isinstance(ret, current_app.response_class):
              response = ret
          elif isinstance(ret, tuple):
              # code, result_dict|msg_string
              if isinstance(ret[1], basestring):
                  response = jsonify(msg=ret[1])
              else:
                  response = jsonify(**ret[1])
              response.status_code = ret[0]
          else:
              response = jsonify(**ret)
          return response
  
      return wrapper
docs: Decorator for simple REST endpoints.
  
      Functions must return one of these values:
      - a dict to jsonify
      - nothing for an empty 204 response
      - a tuple containing a status code and a dict to jsonify