code: def require_oauth_scopes(*scopes):
      r
      required_scopes = set(scopes)
  
      def wrapper(f):
          @wraps(f)
          def decorated(*args, **kwargs):
              # Variable requests.oauth is only defined for oauth requests (see
              # require_api_auth() above).
              if hasattr(request, 'oauth') and request.oauth is not None:
                  token_scopes = set(request.oauth.access_token.scopes)
                  if not required_scopes.issubset(token_scopes):
                      abort(403)
              return f(*args, **kwargs)
          return decorated
      return wrapper
docs: r"""Decorator to require a list of OAuth scopes.
  
      Decorator must be preceded by a ``require_api_auth()`` decorator.
      Note, API key authentication is bypassing this check.
  
      :param \*scopes: List of scopes required.