code: public static String obtainKerberosPrincipal(final State state) throws UnknownHostException {
      if (!state.getProp(KEYTAB_USER).matches(KEYTAB_USER_PATTERN.pattern())) {
        Preconditions.checkArgument(state.contains(KERBEROS_REALM));
        return state.getProp(KEYTAB_USER) + "/" + InetAddress.getLocalHost().getCanonicalHostName() + "@" + state.getProp(
            KERBEROS_REALM);
      } else {
        return state.getProp(KEYTAB_USER);
      }
    }
docs: Obtain kerberos principal in a dynamic way, where the instance's value is determined by the hostname of the machine
  that the job is currently running on.
  It will be invoked when {@link #KEYTAB_USER} is not following pattern specified in {@link #KEYTAB_USER_PATTERN}.
  @throws UnknownHostException