code: @SuppressWarnings("unchecked")
      public <PE extends ExtensionElement> PE getExtension(String elementName, String namespace) {
          if (namespace == null) {
              return null;
          }
          String key = XmppStringUtils.generateKey(elementName, namespace);
          ExtensionElement packetExtension;
          synchronized (payload) {
              packetExtension = payload.getFirst(key);
          }
          if (packetExtension == null) {
              return null;
          }
          return (PE) packetExtension;
      }
docs: Returns the first extension that matches the specified element name and
  namespace, or <tt>null</tt> if it doesn't exist. If the provided elementName is null,
  only the namespace is matched. Extensions are
  are arbitrary XML elements in standard XMPP stanzas.
  
  @param elementName the XML element name of the extension. (May be null)
  @param namespace the XML element namespace of the extension.
  @param <PE> type of the ExtensionElement.
  @return the extension, or <tt>null</tt> if it doesn't exist.