old_contents: from __future__ import unicode_literals
  
  
  class Downloader:
      def __init__(self):
          pass
  
      @staticmethod
      def get_block(elapsed_time, bytes):
          new_min = max(bytes / 2.0, 1.0)
          new_max = min(max(bytes * 2.0, 1.0), 4194304)  # Do not surpass 4 MB
          if elapsed_time < 0.001:
              return int(new_max)
          rate = bytes / elapsed_time
          if rate > new_max:
              return int(new_max)
          if rate < new_min:
              return int(new_min)
          return int(rate)
new_contents: from __future__ import unicode_literals
  
  
  class Downloader:
      def __init__(self):
          self.buffer = None
  
      def set_buffer(self, elapsed_time=None, bytes=None):
          new_min = max(bytes / 2.0, 1.0)
          new_max = min(max(bytes * 2.0, 1.0), 4194304)  # Do not surpass 4 MB
          if elapsed_time < 0.001:
              self.buffer = int(new_max)
          rate = bytes / elapsed_time
          if rate > new_max:
              self.buffer = int(new_max)
          if rate < new_min:
              self.buffer = int(new_min)
          self.buffer = int(rate)
  
subject: change get_buffer to set_buffer and also change how it is implemented