code: public static String getServiceName(String hostname) throws IOException {
      int i = hostname.lastIndexOf(".");
      if (i <= 0) {
        throw badHostName(hostname);
      }
      String service = hostname.substring(i + 1);
      if (service.isEmpty() || service.contains(".")) {
        throw badHostName(hostname);
      }
      return service;
    }
docs: Extracts service name from the container.service
  
  @param hostname hostname
  @return the separated out service name
  @throws IOException if the hostname was invalid