Get back an ET.Element for several possible input formats

def get_element(text_or_tree_or_element):
    """
    Get back an ET.Element for several possible input formats
    """
    if isinstance(text_or_tree_or_element, ET.Element):
        return text_or_tree_or_element
    elif isinstance(text_or_tree_or_element, ET.ElementTree):
        return text_or_tree_or_element.getroot()
    elif isinstance(text_or_tree_or_element, (unicode, bytes)):
        return ET.fromstring(text_or_tree_or_element)
    else:
        return ET.parse(text_or_tree_or_element).getroot()