docs: def wrap(x):
      """
      Wraps an element or integer type by serializing it and base64 encoding 
      the resulting bytes.
      """
      # Detect the type so we can call the proper serialization routine
      if isinstance(x, G1Element):
          return _wrap(x, serializeG1)
  
      elif isinstance(x, G2Element):
          return _wrap(x, serializeG2)
  
      elif isinstance(x, GtElement):
          return _wrap(x, serializeGt)
  
      elif isinstance(x, str):        
          return x
  
      elif isinstance(x, (int, long, BigInt)):
          return hex(long(x))
  
      # All other items
      else:
          raise NotImplementedError("Cannot unwrap {}; only types {} supported".
              format(type(x), 
                  [G1Element, G2Element, GtElement, int, long, BigInt]) )