docs: def _expect(self, expected, times=50):
          """Find the `expected` line within `times` trials.
  
          Args:
              expected    str: the expected string
              times       int: number of trials
          """
          logger.debug('[%s] Expecting [%s]', self.port, expected)
          retry_times = 10
          while times:
              if not retry_times:
                  break
  
              line = self._readline()
  
              if line == expected:
                  return
  
              if not line:
                  retry_times -= 1
                  time.sleep(0.1)
  
              times -= 1
  
          raise Exception('failed to find expected string[%s]' % expected)