code: @Nullable public GeoTarget getIdAncestor(GeoTarget.Type type) {
      for (GeoTarget target = this; target != null; target = target.idParent) {
        if (target.key.type == type) {
          return target;
        }
      }
  
      return null;
    }
docs: Finds an ancestor of a specific type, if possible, using the parent-ID chain.
  You should prefer {@link #getCanonAncestor(Type)}, using this method as last resort.