openrtb-core/src/main/java/com/google/openrtb/util/OpenRtbUtils.java
@Nullable public static Imp bannerImpWithId(
      BidRequest request, @Nullable String impId, String bannerId) {
    checkNotNull(bannerId);

    for (Imp imp : request.getImpList()) {
      if ((impId == null || imp.getId().equals(impId))
          && imp.hasBanner() && imp.getBanner().getId().equals(bannerId)) {
        return imp;
      }
    }

    return null;
  }
@Nullable public static Imp bannerImpWithId(
      BidRequest request, @Nullable String impId, String bannerId) {
    checkNotNull(bannerId);

    for (Imp imp : request.getImpList()) {
      if ((impId == null || imp.getId().equals(impId))
          && imp.hasBanner() && imp.getBanner().getId().equals(bannerId)) {
        return imp;
      }
    }

    return null;
  }
Find an {@link Imp} by its ID and its {@link Banner}'s ID.

@param impId Imp ID; optional if the Banner IDs are unique within the request
@param bannerId Banner ID
@return The {@link Imp} for a given impression ID x banner ID, or {@code null} if not found