code: def brotli(f, *args, **kwargs):
      
  
      data = f(*args, **kwargs)
  
      if isinstance(data, Response):
          content = data.data
      else:
          content = data
  
      deflated_data = _brotli.compress(content)
  
      if isinstance(data, Response):
          data.data = deflated_data
          data.headers['Content-Encoding'] = 'br'
          data.headers['Content-Length'] = str(len(data.data))
  
          return data
  
      return deflated_data
docs: Brotli Flask Response Decorator