def wrap(x):
<EOL>if isinstance(x, G1Element):<EOL><INDENT>return _wrap(x, serializeG1)<EOL><DEDENT>elif isinstance(x, G2Element):<EOL><INDENT>return _wrap(x, serializeG2)<EOL><DEDENT>elif isinstance(x, GtElement):<EOL><INDENT>return _wrap(x, serializeGt)<EOL><DEDENT>elif isinstance(x, str):        <EOL><INDENT>return x<EOL><DEDENT>elif isinstance(x, (int, long, BigInt)):<EOL><INDENT>return hex(long(x))<EOL><DEDENT>else:<EOL><INDENT>raise NotImplementedError("<STR_LIT>".<EOL>format(type(x), <EOL>[G1Element, G2Element, GtElement, int, long, BigInt]) )<EOL><DEDENT>
Wraps an element or integer type by serializing it and base64 encoding 
the resulting bytes.