code: public static StashLocation getStashLocation(URI location) {
          checkArgument(getLocationType(location) == LocationType.STASH, "Not a stash location");
  
          String host, path;
          boolean useLatestDirectory;
  
          Matcher matcher = getLocatorMatcher(location);
          if (matcher.matches()) {
              // Stash is only available for the default group.  Make sure that's the case here
              String group = Objects.firstNonNull(matcher.group("group"), DEFAULT_GROUP);
              checkArgument(DEFAULT_GROUP.equals(group), "Stash not available for group: %s", group);
  
              // Stash it not available for local
              String universe = matcher.group("universe");
              checkArgument(universe != null, "Stash not available for local");
  
              Region region = getRegion(Objects.firstNonNull(matcher.group("region"), DEFAULT_REGION));
  
              host = getS3BucketForRegion(region);
              path = getS3PathForUniverse(universe);
              useLatestDirectory = true;
          } else {
              // The location refers to the actual S3 bucket and path
              host = location.getHost();
              path = location.getPath();
              // Stash paths don't have a leading slash
              if (path != null && path.startsWith("/")) {
                  path = path.substring(1);
              }
              useLatestDirectory = false;
          }
  
          return new StashLocation(host, path, useLatestDirectory);
      }
docs: Returns location information for a given location of type {@link LocationType#STASH}.