Function compresses data and returns the generated ASN.1
    
    :param data_to_compress: A byte string of the data to be compressed
    
    :return: A CMS ASN.1 byte string of the compressed data.

def compress_message(data_to_compress):
    """Function compresses data and returns the generated ASN.1
    
    :param data_to_compress: A byte string of the data to be compressed
    
    :return: A CMS ASN.1 byte string of the compressed data.    
    """
    compressed_content = cms.ParsableOctetString(
        zlib.compress(data_to_compress))
    return cms.ContentInfo({
        'content_type': cms.ContentType('compressed_data'),
        'content': cms.CompressedData({
            'version': cms.CMSVersion('v0'),
            'compression_algorithm':
                cms.CompressionAlgorithm({
                    'algorithm': cms.CompressionAlgorithmId('zlib')
                }),
            'encap_content_info': cms.EncapsulatedContentInfo({
                'content_type': cms.ContentType('data'),
                'content': compressed_content
            })
        })
    }).dump()