def remove_namespace(tree):
    """
    Namespace can make Splunk output ugly.  This function removes namespace from all elements
    e.g element.tag = '{http://schemas.microsoft.com/win/2004/08/events/event}System'
    :param tree: xml ElementTree Element
    :return: xml ElementTree Element with namespace removed
    """
    # Remove namespace
    for element in tree.getiterator():
        try:
            if element.tag.startswith('{'):
                element.tag = element.tag.split('}')[1]
        except:
            pass

    return tree