<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_nio(self, nio, port_number):
 """ Adds a NIO as new port on this cloud. :param nio: NIO instance to add :param port_number: port to allocate for the NIO """


        if port_number in self._nios:
            raise NodeError("Port {} isn't free".format(port_number))

        log.info('Cloud "{name}" [{id}]: NIO {nio} bound to port {port}'.format(name=self._name,
                                                                                id=self._id,
                                                                                nio=nio,
                                                                                port=port_number))
        try:
            yield from self.start()
            yield from self._add_ubridge_connection(nio, port_number)
            self._nios[port_number] = nio
        except NodeError as e:
            self.project.emit("log.error", {"message": str(e)})
            yield from self._stop_ubridge()
            self.status = "stopped"
            self._nios[port_number] = nio
        # Cleanup stuff
        except UbridgeError as e:
            self.project.emit("log.error", {"message": str(e)})
            yield from self._stop_ubridge()
            self.status = "stopped"
            self._nios[port_number] = nio