code: public String getAttribute(final Attributes attributes, final String attributeName) throws NamingException {
          if (attributes == null || attributes.size() == 0) {
              return null;
          } else {
              final Attribute attribute = attributes.get(attributeName);
              if (attribute != null) {
                  final Object o = attribute.get();
                  if (o instanceof String) {
                      return (String) attribute.get();
                  }
              }
          }
          return null;
      }
docs: Retrieves an attribute by its name.
  @param attributes the list of attributes to query on
  @param attributeName the name of the attribute to return
  @return the value of the attribute, or null if not found
  @throws NamingException if an exception is thrown
  @since 1.4.0