def xz_compress_stream(src):
compressor = lzma.LZMACompressor(<EOL>check=lzma.CHECK_CRC64,<EOL>filters=[<EOL>{"<STR_LIT:id>": lzma.FILTER_X86},<EOL>{"<STR_LIT:id>": lzma.FILTER_LZMA2,<EOL>"<STR_LIT>": lzma.PRESET_DEFAULT},<EOL>])<EOL>for block in src:<EOL><INDENT>encoded = compressor.compress(block)<EOL>if encoded:<EOL><INDENT>yield encoded<EOL><DEDENT><DEDENT>yield compressor.flush()<EOL>
Compress data from `src`.

    Args:
        src (iterable): iterable that yields blocks of data to compress

    Yields:
        blocks of compressed data