import bz2


def compressed_length(fragment):
    """Return a feature vector with the ratio of the compressed length of the
    file fragment to the actual length of the file fragment
    """
    return [ float( len(bz2.compress(fragment)) ) / float(len(fragment)) ]