Convert a UNTL Python object to a highwire Python object.

def untlpy2highwirepy(untl_elements, **kwargs):
    """Convert a UNTL Python object to a highwire Python object."""
    highwire_list = []
    title = None
    publisher = None
    creation = None
    escape = kwargs.get('escape', False)
    for element in untl_elements.children:
        # If the UNTL element should be converted to highwire,
        # create highwire element.
        if element.tag in HIGHWIRE_CONVERSION_DISPATCH:
            highwire_element = HIGHWIRE_CONVERSION_DISPATCH[element.tag](
                qualifier=element.qualifier,
                content=element.content,
                children=element.children,
                escape=escape,
            )
            if highwire_element:
                if element.tag == 'title':
                    if element.qualifier != 'officialtitle' and not title:
                        title = highwire_element
                    elif element.qualifier == 'officialtitle':
                        title = highwire_element
                elif element.tag == 'publisher':
                    if not publisher:
                        # This is the first publisher element.
                        publisher = highwire_element
                        highwire_list.append(publisher)
                elif element.tag == 'date':
                    # If a creation date hasn't been found yet,
                    # verify this date is acceptable.
                    if not creation and element.qualifier == 'creation':
                        if highwire_element.content:
                            creation = highwire_element
                            if creation:
                                highwire_list.append(creation)
                # Otherwise, add the element to the list if it has content.
                elif highwire_element.content:
                    highwire_list.append(highwire_element)
        # If the title was found, add it to the list.
    if title:
        highwire_list.append(title)
    return highwire_list