:return: the root key, and a dict with all the XML data, but without preserving structure, for instance:

    <elem val="attribute"><val>nested text</val><val prop="attr">nested dict text</val>nested dict tail</elem>
    {'elem': {
        'val': [
            u'nested text',
            {'prop': u'attr', 'value': [u'nested dict text', u'nested dict tail']},
            u'attribute'
        ]
    }}

def element_to_object(elem_to_parse, element_path=None):
    """
    :return: the root key, and a dict with all the XML data, but without preserving structure, for instance:

    <elem val="attribute"><val>nested text</val><val prop="attr">nested dict text</val>nested dict tail</elem>
    {'elem': {
        'val': [
            u'nested text',
            {'prop': u'attr', 'value': [u'nested dict text', u'nested dict tail']},
            u'attribute'
        ]
    }}
    """

    if isinstance(elem_to_parse, STRING_TYPES) or hasattr(elem_to_parse, 'read'):
        # Always strip namespaces if not already parsed
        elem_to_parse = strip_namespaces(elem_to_parse)

    if element_path is not None:
        elem_to_parse = get_element(elem_to_parse, element_path)

    element_tree = get_element_tree(elem_to_parse)
    element_root = element_tree.getroot()
    root_tag = u'' if element_root is None else element_root.tag

    return root_tag, {root_tag: _element_to_object(element_root)}