code: def default_stream_factory(
      total_content_length, filename, content_type, content_length=None
  ):
      
      max_size = 1024 * 500
      if SpooledTemporaryFile is not None:
          return SpooledTemporaryFile(max_size=max_size, mode="wb+")
      if total_content_length is None or total_content_length > max_size:
          return TemporaryFile("wb+")
      return BytesIO()
docs: The stream factory that is used per default.