code: def _extract(archive, compression, cmd, format, verbosity, outdir):
      
      targetname = util.get_single_outfile(outdir, archive)
      try:
          with lzma.LZMAFile(archive, **_get_lzma_options(format)) as lzmafile:
              with open(targetname, 'wb') as targetfile:
                  data = lzmafile.read(READ_SIZE_BYTES)
                  while data:
                      targetfile.write(data)
                      data = lzmafile.read(READ_SIZE_BYTES)
      except Exception as err:
          msg = "error extracting %s to %s: %s" % (archive, targetname, err)
          raise util.PatoolError(msg)
      return None
docs: Extract an LZMA or XZ archive with the lzma Python module.