'Dict setter method for NaElement.
Accepts dict, list, tuple, str, int, float and long as valid value.'

def __setitem__(self, key, value):

    if key:
        if value:
            if isinstance(value, NaElement):
                child = NaElement(key)
                child.add_child_elem(value)
                self.add_child_elem(child)
            elif isinstance(value, (six.integer_types + (str, float))):
                self.add_new_child(key, six.text_type(value))
            elif isinstance(value, (list, tuple, dict)):
                child = NaElement(key)
                child.translate_struct(value)
                self.add_child_elem(child)
            else:
                raise TypeError(_('Not    a    valid    value    for    NaElement.'))
        else:
            self.add_child_elem(NaElement(key))
    else:
        raise KeyError(_('NaElement    name    cannot    be    null.'))
