def initiate_operation(self, success_callback, timeout_callback,
                           timeout=None, cookie=None):
        """Register an operation which request is about to be sent.

        This method can be called by vendor handlers to initiate
        vendor-specific operations.

        Args:
            success_callback: The callable to call when the
                operation's reply is received, and its extra args.The
                handling of this callable must be done in each
                reply-specific handler.
            timeout_callback: The callable to call if the operation
                times out.
            timeout: The period, in seconds, before the operation
                times out. If None (default), defaults to the
                default_op_timeout.
            cookie: An opaque value that must be equal to the cookie
                given at operation termination. This should typically
                be the OFPT_* request message type. Defaults to None.

        Returns:
            The next transaction ID, to be associated with the sent
            request, as a 32-bit unsigned integer.
        """
        xid = None
        with self._pending_ops_lock:
            first_xid = xid = self._get_next_xid()
            while xid in self._pending_ops:
                xid = self._get_next_xid()
                if first_xid == xid:  # tried all values
                    raise ValueError('no unused XID')
            if timeout is None:
                timeout = self.default_op_timeout
            timeout_delayed_call = self.reactor.callLater(
                timeout, self._timeout_operation, xid)
            self._pending_ops[xid] = PendingOperation(
                cookie, success_callback, timeout_callback,
                timeout_delayed_call)
        return xid
dataset/ETHPy150Open rlenglet/openfaucet/src/openfaucet/ofprotoops.py/OpenflowProtocolOperations.initiate_operation/original