code: def serial_port(self, serial_port):
          
          char_size = get_char_size(serial_port.baudrate)
  
          # See docstring of get_char_size() for meaning of constants below.
          serial_port.inter_byte_timeout = 1.5 * char_size
          serial_port.timeout = 3.5 * char_size
          self._serial_port = serial_port
docs: Set timeouts on serial port based on baudrate to detect frames.