'Update VirtCPUModel object according to libvirt CPU config.
:param:cpu_config: vconfig.LibvirtConfigGuestCPU presenting the
instance\'s virtual cpu configuration.
:param:vcpu_model: VirtCPUModel object. A new object will be created
if None.
:return: Updated VirtCPUModel object, or None if cpu_config is None'

def _cpu_config_to_vcpu_model(self, cpu_config, vcpu_model):

    if (not cpu_config):
        return
    if (not vcpu_model):
        vcpu_model = objects.VirtCPUModel()
    vcpu_model.arch = cpu_config.arch
    vcpu_model.vendor = cpu_config.vendor
    vcpu_model.model = cpu_config.model
    vcpu_model.mode = cpu_config.mode
    vcpu_model.match = cpu_config.match
    if cpu_config.sockets:
        vcpu_model.topology = objects.VirtCPUTopology(sockets=cpu_config.sockets, cores=cpu_config.cores, threads=cpu_config.threads)
    else:
        vcpu_model.topology = None
    features = [objects.VirtCPUFeature(name=f.name, policy=f.policy) for f in cpu_config.features]
    vcpu_model.features = features
    return vcpu_model
