def etree_equal(a, b):
    """
    Determine whether two :class:`xml.etree.ElementTree.Element` trees are
    equivalent.

    >>> from xml.etree.ElementTree import Element, SubElement as SE, fromstring
    >>> a = fromstring('<root/>')
    >>> b = fromstring('<root/>')
    >>> etree_equal(a, a), etree_equal(a, b)
    (True, True)
    >>> c = fromstring('<root attrib="value" />')
    >>> d = fromstring('<root attrib="value" />')
    >>> etree_equal(a, c), etree_equal(c, d)
    (False, True)
    """
    return (
        a.tag == b.tag
        and a.text == b.text
        and a.tail == b.tail
        and a.attrib == b.attrib
        and len(a) == len(b)
        and all(etree_equal(x, y) for (x, y) in zip(a, b))
    )