Helper function to retry USB.

def _retry_usb_function(count, func, *args, **kwargs):
  """Helper function to retry USB."""
  helper = timeouts.RetryHelper(count)
  while True:
    try:
      return func(*args, **kwargs)
    except usb_exceptions.CommonUsbError:
      if not helper.retry_if_possible():
        raise
      time.sleep(0.1)
    else:
      break