code: public Optional<Location> firstParentLocationWithScope(LocationScope locationScope) {
      checkNotNull(locationScope, "locationScope is null");
  
      if (location.locationScope().equals(locationScope)) {
        return Optional.of(location);
      }
  
      for (Location iteration : this) {
        if (iteration.locationScope().equals(locationScope)) {
          return Optional.of(iteration);
        }
      }
      return Optional.empty();
    }
docs: Returns an {@link Optional} first parent location that has the given scope.
  <p>
  Will iterate upwards through the location hierarchy and return the first location that matches
  the given scope.
  
  @param locationScope the scope to check for
  @return an {@link Optional} first parent location or {@link Optional::empty}
  @throws NullPointerException if the given locationScope is null.