code: @SuppressWarnings("unchecked")
      public <T> T findCallback(Fragment fragment, Class<T> callbackType) {
  
          Fragment back = getBackFragment(fragment);
  
          if (back != null && callbackType.isAssignableFrom(back.getClass()))
              return (T)back;
  
          if (callbackType.isAssignableFrom(activity.getClass()))
              return (T)activity;
  
          return null;
      }
docs: Returns a back fragment if the fragment is of given class.
  If such fragment does not exist and activity implements the given class then the activity will be returned.
  
  @param fragment     a fragment to search from.
  @param callbackType a class of type for callback to search.
  @param <T>          a type of callback.
  @return a back fragment or activity.