code: def uncompressed_size(filename):
      
  
      quoted_filename = shlex.quote(filename)
  
      # TODO: get filetype from file-magic, if available
      if str(filename).lower().endswith(".xz"):
          output = execute_command('xz --list "{}"'.format(quoted_filename))
          compressed, uncompressed = regexp_sizes.findall(output)
          value, unit = uncompressed.split()
          value = float(value.replace(",", ""))
          return int(value * MULTIPLIERS[unit])
  
      elif str(filename).lower().endswith(".gz"):
          # XXX: gzip only uses 32 bits to store uncompressed size, so if the
          # uncompressed size is greater than 4GiB, the value returned will be
          # incorrect.
          output = execute_command('gzip --list "{}"'.format(quoted_filename))
          lines = [line.split() for line in output.splitlines()]
          header, data = lines[0], lines[1]
          gzip_data = dict(zip(header, data))
          return int(gzip_data["uncompressed"])
  
      else:
          raise ValueError('Unrecognized file type for "{}".'.format(filename))
docs: Return the uncompressed size for a file by executing commands
  
      Note: due to a limitation in gzip format, uncompressed files greather than
      4GiB will have a wrong value.