code: def encode_streaming(self, data):
          
          # Buffer value and size
          buffer = 0
          size = 0
          for s in data:
              b, v = self._table[s]
              # Shift new bits in the buffer
              buffer = (buffer << b) + v
              size += b
              while size >= 8:
                  byte = buffer >> (size - 8)
                  yield to_byte(byte)
                  buffer = buffer - (byte << (size - 8))
                  size -= 8
  
          # Handling of the final sub-byte chunk.
          # The end of the encoded bit stream does not align necessarily with byte boundaries,
          # so we need an "end of file" indicator symbol (_EOF) to guard against decoding
          # the non-data trailing bits of the last byte.
          # As an optimization however, while encoding _EOF, it is only necessary to encode up to
          # the end of the current byte and cut off there.
          # No new byte has to be started for the remainder, saving us one (or more) output bytes.
          if size > 0:
              b, v = self._table[_EOF]
              buffer = (buffer << b) + v
              size += b
              if size >= 8:
                  byte = buffer >> (size - 8)
              else:
                  byte = buffer << (8 - size)
              yield to_byte(byte)
docs: Encode given data in streaming fashion.
  
          :param data: sequence of symbols (e.g. byte string, unicode string, list, iterator)
          :return: generator of bytes (single character strings in Python2, ints in Python 3)