def xml_elements_equal(first, second):
    """
    Tests two XML elements for equality.

    Parameters
    ----------
    first : _Element
        The first element.
    second : _Element
        The second element.

    Returns
    -------
    bool
        Whether the two elements are equal.
    """
    if first.tag != second.tag:
        return False
    if first.text != second.text:
        return False
    if first.tail != second.tail:
        return False
    if first.attrib != second.attrib:
        return False
    if len(first) != len(second):
        return False
    return all(xml_elements_equal(c1, c2) for c1, c2 in zip(first, second))