Let\'s consider the following example. Using Python library tinyec I can write the following code:
def compress(pubKey): return hex(pubKey.x) + hex(pubKey.y