code: def auth_optional(validator):
      
      def _auth_optional_decorator(handler):
          if inspect.isclass(handler):
              return _wrap_class(handler, validator)
          return _auth_optional(handler, validator)
  
      return _auth_optional_decorator
docs: Decorate a RequestHandler or method to accept optional authentication token
  
      If decorating a coroutine make sure coroutine decorator is first.
      eg.::
  
          class Handler(tornado.web.RequestHandler):
  
              @auth_required(validator)
              @coroutine
              def get(self):
                  pass
  
      :param validator: a coroutine that will validate the token and return True/False