def _serialize(element, compress, relicSizeBinFunc, relicWriteBinFunc):
cFlag = c_int(compress)<EOL>size = relicSizeBinFunc(byref(element), cFlag)<EOL>binArray = (c_ubyte*size)()<EOL>relicWriteBinFunc(byref(binArray), size, byref(element), cFlag)<EOL>return bytearray(binArray)<EOL>
Serializes an @element using the proper function @relicWriteBinFunc into
a bytearray. @compress specifies whether the element should be compressed.
@relicSizeBinFunc is used to determine the size of the serialized output.
This is underlying implementation for serialize G1, G2, and Gt.