def toBase64(data): try: return Base64Utils.toBase64(data.getBytes('UTF-8')) except Exception, e: raise UnexpectedException(e)
def fromBase64(encoded): try: return str(Base64Utils.fromBase64(encoded)).encode('UTF-8') except Exception, e: raise UnexpectedException(e)