docs: def stream_random_bytes(n):
      """Streams n random bytes generated with given seed, at given chunk size per packet.
      ---
      tags:
        - Dynamic data
      parameters:
        - in: path
          name: n
          type: int
      produces:
        - application/octet-stream
      responses:
        200:
          description: Bytes.
      """
      n = min(n, 100 * 1024)  # set 100KB limit
  
      params = CaseInsensitiveDict(request.args.items())
      if "seed" in params:
          random.seed(int(params["seed"]))
  
      if "chunk_size" in params:
          chunk_size = max(1, int(params["chunk_size"]))
      else:
          chunk_size = 10 * 1024
  
      def generate_bytes():
          chunks = bytearray()
  
          for i in xrange(n):
              chunks.append(random.randint(0, 255))
              if len(chunks) == chunk_size:
                  yield (bytes(chunks))
                  chunks = bytearray()
  
          if chunks:
              yield (bytes(chunks))
  
      headers = {"Content-Type": "application/octet-stream"}
  
      return Response(generate_bytes(), headers=headers)