#NEWLINE# def mccp_compress( protocol , data ) : #NEWLINE# #INDENT# '\n    Handles zlib compression, if applicable.\n\n    Args:\n        data (str): Incoming data to compress.\n\n    Returns:\n        stream (binary): Zlib-compressed data.\n\n    ' #NEWLINE# if hasattr ( data , 'zlib' ) : #NEWLINE# #INDENT# return ( protocol . zlib . compress ( data ) + protocol . zlib . flush ( FLUSH ) ) #NEWLINE# #UNINDENT# return data