code: def __clear_buffers(self):
          
          try:
              self._port.reset_input_buffer()
              self._port.reset_output_buffer()
          except AttributeError:
              #pySerial 2.7
              self._port.flushInput()
              self._port.flushOutput()
docs: Clears the input and output buffers