code: def xz_compress_stream(src):
      
      compressor = lzma.LZMACompressor(
          check=lzma.CHECK_CRC64,
          filters=[
              {"id": lzma.FILTER_X86},
              {"id": lzma.FILTER_LZMA2,
               "preset": lzma.PRESET_DEFAULT},
          ])
      for block in src:
          encoded = compressor.compress(block)
          if encoded:
              yield encoded
      yield compressor.flush()
docs: Compress data from `src`.
  
      Args:
          src (iterable): iterable that yields blocks of data to compress
  
      Yields:
          blocks of compressed data