def assign(self, net_key, ch_type):
        msg = message.ChannelAssignMessage(number=self.number)
        msg.setNetworkNumber(self.node.getNetworkKey(net_key).number)
        msg.setChannelType(ch_type)
        self.node.driver.write(msg.encode())
        if self.node.evm.waitForAck(msg) != RESPONSE_NO_ERROR:
            raise ChannelError('Could not assign channel.')
        self.is_free = False
dataset/ETHPy150Open mvillalba/python-ant/src/ant/core/node.py/Channel.assign/original