def read(self, size=None):
    if not self._is_open:
      raise IOError(u'Not opened.')

    if self._current_offset < 0:
      raise IOError(u'Invalid current offset value less than zero.')

    if self._current_offset > self._uncompressed_stream_size:
      return b''

    if (size is None or
        self._current_offset + size > self._uncompressed_stream_size):
      size = self._uncompressed_stream_size - self._current_offset

    if self._realign_offset:
      self._AlignUncompressedDataOffset(self._current_offset)
      self._realign_offset = False

    uncompressed_data = b''

    # Read in full blocks of uncompressed data.
    while self._uncompressed_data_offset + size > self._uncompressed_data_size:
      uncompressed_data = b''.join([
          uncompressed_data,
          self._uncompressed_data[self._uncompressed_data_offset:]])

      remaining_uncompressed_data_size = (
          self._uncompressed_data_size - self._uncompressed_data_offset)

      self._current_offset += remaining_uncompressed_data_size
      size -= remaining_uncompressed_data_size

      self._ReadCompressedData(self._UNCOMPRESSED_DATA_BUFFER_SIZE)

      self._uncompressed_data_offset = 0

    # Read in partial block of uncompressed data.
    if (size > 0 and
        self._uncompressed_data_offset + size <= self._uncompressed_data_size):
      slice_start_offset = self._uncompressed_data_offset
      slice_end_offset = slice_start_offset + size

      uncompressed_data = b''.join([
          uncompressed_data,
          self._uncompressed_data[slice_start_offset:slice_end_offset]])

      self._uncompressed_data_offset += size
      self._current_offset += size

    return uncompressed_data
Return value from object converted to string properly
dataset/ETHPy150Open log2timeline/dfvfs/dfvfs/file_io/zip_file_io.py/ZipFile.read--crossover with--dataset/ETHPy150Open pennersr/django-allauth/allauth/socialaccount/fields.py/JSONField.value_to_string