def _get_baudrate(self):
        # Get tty attributes
        try:
            (_, _, _, _, _, ospeed, _) = termios.tcgetattr(self._fd)
        except termios.error as e:
            raise SerialError(e.errno, "Getting serial port attributes: " + e.strerror)

        if ospeed not in Serial._OSPEED_TO_BAUDRATE:
            raise SerialError(None, "Unknown baud rate: ospeed 0x%x." % ospeed)

        return Serial._OSPEED_TO_BAUDRATE[ospeed]
dataset/ETHPy150Open vsergeev/python-periphery/periphery/serial.py/Serial._get_baudrate/original