'Return the value of a stanza interface using dict-like syntax.
Example::
>>> msg[\'body\']
\'Message contents\'
Stanza interfaces are typically mapped directly to the underlying XML
object, but can be overridden by the presence of a ``get_attrib``
method (or ``get_foo`` where the interface is named ``\'foo\'``, etc).
The search order for interface value retrieval for an interface
named ``\'foo\'`` is:
1. The list of substanzas (``\'substanzas\'``)
2. The result of calling the ``get_foo`` override handler.
3. The result of calling ``get_foo``.
4. The result of calling ``getFoo``.
5. The contents of the ``foo`` subelement, if ``foo`` is listed
in :attr:`sub_interfaces`.
6. True or False depending on the existence of a ``foo``
subelement and ``foo`` is in :attr:`bool_interfaces`.
7. The value of the ``foo`` attribute of the XML object.
8. The plugin named ``\'foo\'``
9. An empty string.
:param string attrib: The name of the requested stanza interface.'

def __getitem__(self, attrib):

    full_attrib = attrib
    attrib_lang = (u'%s|' % attrib).split(u'|')
    attrib = attrib_lang[0]
    lang = (attrib_lang[1] or None)
    kwargs = {}
    if (lang and (attrib in self.lang_interfaces)):
        kwargs[u'lang'] = lang
    kwargs = safedict(kwargs)
    if (attrib == u'substanzas'):
        return self.iterables
    elif ((attrib in self.interfaces) or (attrib == u'lang')):
        get_method = (u'get_%s' % attrib.lower())
        get_method2 = (u'get%s' % attrib.title())
        if self.plugin_overrides:
            name = self.plugin_overrides.get(get_method, None)
            if name:
                plugin = self._get_plugin(name, lang)
                if plugin:
                    handler = getattr(plugin, get_method, None)
                    if handler:
                        return handler(**kwargs)
        if hasattr(self, get_method):
            return getattr(self, get_method)(**kwargs)
        elif hasattr(self, get_method2):
            return getattr(self, get_method2)(**kwargs)
        elif (attrib in self.sub_interfaces):
            return self._get_sub_text(attrib, lang=lang)
        elif (attrib in self.bool_interfaces):
            elem = self.xml.find((u'{%s}%s' % (self.namespace, attrib)))
            return (elem is not None)
        else:
            return self._get_attr(attrib)
    elif (attrib in self.plugin_attrib_map):
        plugin = self._get_plugin(attrib, lang)
        if (plugin and plugin.is_extension):
            return plugin[full_attrib]
        return plugin
    else:
        return u''
