def handle_vesicle(self, data):
        """
        Parse received vesicles and call handler

        Args:
            data (String): JSON encoded Vesicle

        Returns:
            Vesicle: The Vesicle that was decrypted and loaded
            None: If no Vesicle could be loaded
        """

        try:
            vesicle = Vesicle.read(data)
        except PersonaNotFoundError, e:
            self.logger.info("Received Vesicle from unknown Persona, trying to retrieve Persona info.")
            resp, errors = self.electrical.persona_info(e[0])
            if errors:
                self.logger.warning("Could not retrieve unknown Persona from server:\n{}".format(", ".join(errors)))
                return
            else:
                vesicle = Vesicle.read(data)

        if vesicle is None:
            self.logger.error("Failed handling Vesicle due to decoding error")
        else:
            old_vesicle = Vesicle.query.get(vesicle.id)
            if old_vesicle is not None:
                vesicle = old_vesicle

            # Vesicle is loaded and has not yet been handled, start processing..
            session = create_session()

            # Decrypt if neccessary
            import keyczar
            if not vesicle.decrypted():
                try:
                    reader_persona = vesicle.decrypt()
                except UnauthorizedError:
                    self.logger.info("Not authorized to decrypt {}".format(vesicle))
                except keyczar.errors.InvalidSignatureError:
                    self.logger.warning("Failed decrypting {}: id={} h={}".format(vesicle, vesicle.id, vesicle._get_hashcode()))
                    return vesicle

            if old_vesicle is None:
                session.add(vesicle)
                session.commit()

            if not vesicle.decrypted():
                self.logger.debug("{} has encrypted payload.".format(vesicle))
            else:
                self.logger.info("{} has payload:\n{}".format(vesicle, json.dumps(vesicle.data, indent=2)))

            # Call handler depending on message type
            try:
                if vesicle is not None and not vesicle.handled and ALLOWED_MESSAGE_TYPES in vesicle.message_type:
                    handler = getattr(self, "handle_{}".format(vesicle.message_type))
                    try:
                        handler(vesicle, reader_persona, session)
                    except UnauthorizedError, e:
                        self.logger.error("Error handling {}: {}".format(vesicle, e))
            except:
                session.rollback()
                raise
            finally:
                session.flush()

        return vesicle
dataset/ETHPy150Open ciex/souma/synapse/__init__.py/Synapse.handle_vesicle/swapped operands of `in`