def receive(self):
        data = b''
        try:
            data = os.read(self.fd, self.bs)  #if no chars available generates exception
        except OSError as ex1:  # ex1 is the target instance of the exception
            if ex1.errno == errno.EAGAIN: #BSD 35, Linux 11
                pass #No characters available
            else:
                raise #re raise exception ex1

        return data
Reads nonblocking characters from serial device up to bs characters
dataset/ETHPy150Open ioflo/ioflo/ioflo/aio/serial/serialing.py/DeviceNb.receive