'Returns the host capabilities information
Returns an instance of config.LibvirtConfigCaps representing
the capabilities of the host.
Note: The result is cached in the member attribute _caps.
:returns: a config.LibvirtConfigCaps object'

def get_capabilities(self):

    if (not self._caps):
        xmlstr = self.get_connection().getCapabilities()
        LOG.info('Libvirt    host    capabilities    %s', xmlstr)
        self._caps = vconfig.LibvirtConfigCaps()
        self._caps.parse_str(xmlstr)
        if (hasattr(libvirt, 'VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES') and (self._caps.host.cpu.model is not None)):
            try:
                xml_str = self._caps.host.cpu.to_xml()
                if (six.PY3 and isinstance(xml_str, six.binary_type)):
                    xml_str = xml_str.decode('utf-8')
                features = self.get_connection().baselineCPU([xml_str], libvirt.VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES)
                if features:
                    cpu = vconfig.LibvirtConfigCPU()
                    cpu.parse_str(features)
                    self._caps.host.cpu.features = cpu.features
            except libvirt.libvirtError as ex:
                error_code = ex.get_error_code()
                if (error_code == libvirt.VIR_ERR_NO_SUPPORT):
                    LOG.warning('URI    %(uri)s    does    not    support    full    set    of    host    capabilities:    %(error)s', {'uri': self._uri, 'error': ex})
                else:
                    raise
    return self._caps
