<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def compress(bytes, target):
 """ Compress a list of byte values to a fixed target length. [205, 128, 156, 96] Attempting to compress a smaller number of bytes to a larger number is an error: Traceback (most recent call last):
 ValueError: Fewer input bytes than requested output """


        length = len(bytes)
        if target > length:
            raise ValueError("Fewer input bytes than requested output")

        # Split `bytes` into `target` segments.
        seg_size = length // target
        segments = [bytes[i * seg_size:(i + 1) * seg_size]
                    for i in range(target)]
        # Catch any left-over bytes in the last segment.
        segments[-1].extend(bytes[target * seg_size:])

        # Use a simple XOR checksum-like function for compression.
        checksum = lambda bytes: reduce(operator.xor, bytes, 0)
        checksums = list(map(checksum, segments))
        return checksums