code: public static Observable<ViewQueryResponse> retryOnCondition(final Observable<ViewQueryResponse> input) {
          return input
              .flatMap(new Func1<ViewQueryResponse, Observable<ViewQueryResponse>>() {
                  @Override
                  public Observable<ViewQueryResponse> call(final ViewQueryResponse response) {
                      return passThroughOrThrow(response);
                  }
              })
              .retryWhen(new Func1<Observable<? extends Throwable>, Observable<?>>() {
                  @Override
                  public Observable<?> call(Observable<? extends Throwable> observable) {
                      return observable
                          .flatMap(new Func1<Throwable, Observable<?>>() {
                              @Override
                              public Observable<?> call(Throwable throwable) {
                                  if (throwable instanceof ShouldRetryViewRequestException
                                      || throwable instanceof RequestCancelledException) {
                                      return Observable.timer(10, TimeUnit.MILLISECONDS);
                                  } else {
                                      return Observable.error(throwable);
                                  }
                              }
                          });
                  }
              })
              .last();
      }
docs: Takes a {@link ViewQueryResponse}, verifies their status based on fixed criteria and resubscribes if needed.
  
  If it needs to be retried, the resubscription will happen after 10 milliseconds to give the underlying code
  some time to recover.
  
  @param input the original response.
  @return the good response which can be parsed, or a failing observable.