def ConnectedPB(fCallback):
    """
    Used as a decorator to check for PB connection, it will raise an exception
    if connection is not established
    """

    def check_cnx_and_call(self, *args, **kwargs):
        if self.isConnected is False:
            raise Exception("PB proxy is not connected !")

        return fCallback(self, *args, **kwargs)

    return check_cnx_and_call