docs: @NonNull
      private static <T> ObservableTransformer<T, T> takeUntil(Observable<?> beforeEmission, Observable<?> afterEmission) {
          return observable -> observable.publish(publishedObservable -> {
                      final Observable<?> afterEmissionTakeUntil = publishedObservable
                              .take(1)
                              .ignoreElements()
                              .andThen(afterEmission);
                      return Observable.amb(
                              asList(
                                      publishedObservable,
                                      publishedObservable.takeUntil(beforeEmission)
                              ))
                              .takeUntil(afterEmissionTakeUntil);
                  }
          );
      }