def _to_text(nodes_or_text):
    """Convert a xpath object (a string or a list of nodes) to string"""
    element0 = nodes_or_text[0] if isinstance(nodes_or_text, list
        ) else nodes_or_text
    return element0 if isinstance(element0, str) else element0.xpath(
        'string(.)')
