def CopyStreamPart(source, destination, content_size):
 bytes_copied = 0
 bytes_left = content_size
 while (bytes_left > 0):
  bytes = source.read(min(bytes_left, COPY_BLOCK_SIZE))
  bytes_read = len(bytes)
  if (bytes_read == 0):
   break
  destination.write(bytes)
  bytes_copied += bytes_read
  bytes_left -= bytes_read
 return bytes_copied

def CopyStreamPart ( source , destination , content_size ) : bytes_copied = 0 bytes_left = content_size while ( bytes_left > 0 ) : bytes = source . read ( min ( bytes_left , COPY_BLOCK_SIZE ) ) bytes_read = len ( bytes ) if ( bytes_read == 0 ) : break destination . write ( bytes ) bytes_copied += bytes_read bytes_left -= bytes_read return bytes_copied
copy a portion of a stream from one file-like object to another .