code: public static Optional<Long> getRateIfRateControlled(FileSystem fs) {
      if (fs instanceof Decorator) {
        List<Object> lineage = DecoratorUtils.getDecoratorLineage(fs);
        for (Object obj : lineage) {
          if (obj instanceof RateControlledFileSystem) {
            return Optional.of(((RateControlledFileSystem) obj).limitPerSecond);
          }
        }
        return Optional.absent();
      }
      return Optional.absent();
    }
docs: Determines whether the file system is rate controlled, and if so, returns the allowed rate in operations per
  second.
  @param fs {@link FileSystem} to check for rate control.
  @return {@link Optional#absent} if file system is not rate controlled, otherwise, the rate in operations per second.