code: public PackageElement getAbbreviatedPackageElement(PackageElement pkg) {
          String parsedPackageName = utils.parsePackageName(pkg);
          ModuleElement encl = (ModuleElement) pkg.getEnclosingElement();
          PackageElement abbrevPkg = encl == null
                  ? utils.elementUtils.getPackageElement(parsedPackageName)
                  : ((JavacElements) utils.elementUtils).getPackageElement(encl, parsedPackageName);
          return abbrevPkg;
      }
docs: Returns a representation of the package truncated to two levels.
  For instance if the given package represents foo.bar.baz will return
  a representation of foo.bar
  @param pkg the PackageElement
  @return an abbreviated PackageElement