def get_spice_ports_for_instance(instance_name):
    virt_dom = self._lookup_by_name(instance_name)
    xml = virt_dom.XMLDesc(0)
    dom = xmlutils.safe_minidom_parse_string(xml)
    for graphic in dom.getElementsByTagName('graphics'):
        if (graphic.getAttribute('type') == 'spice'):
            return (graphic.getAttribute('port'), graphic.getAttribute('tlsPort'))
    raise exception.ConsoleTypeUnavailable(console_type='spice')
def get_spice_ports_for_instance(instance_name):
    virt_dom = self._lookup_by_name(instance_name)
    xml = virt_dom.XMLDesc(0)
    dom = xmlutils.safe_minidom_parse_string(xml)
    for graphic in dom.getElementsByTagName('graphics'):
        if (graphic.getAttribute('type') == 'spice'):
            return (graphic.getAttribute('port'), graphic.getAttribute('tlsPort'))
    raise exception.ConsoleTypeUnavailable(console_type='spice')