<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 Frame Relay switch. :param nio: NIO instance to add :param port_number: port to allocate for the NIO """


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

        log.info('Frame Relay switch "{name}" [{id}]: NIO {nio} bound to port {port}'.format(name=self._name,
                                                                                             id=self._id,
                                                                                             nio=nio,
                                                                                             port=port_number))

        self._nios[port_number] = nio
        yield from self.set_mappings(self._mappings)