def generate_custom(self, cpu, vcpu_num, fill_topology):
try:<EOL><INDENT>cpu = utils.dict_to_xml({'<STR_LIT>': cpu})<EOL><DEDENT>except:<EOL><INDENT>raise LagoInitException('<STR_LIT>')<EOL><DEDENT>if not cpu.xpath('<STR_LIT>') and fill_topology:<EOL><INDENT>cpu.append(self.generate_topology(vcpu_num))<EOL><DEDENT>return cpu<EOL>
Generate custom CPU model. This method attempts to convert the dict to
XML, as defined by ``xmltodict.unparse`` method.

Args:
    cpu(dict): CPU spec
    vcpu_num(int): number of virtual cpus
    fill_topology(bool): if topology is not defined in ``cpu`` and
        ``vcpu`` was not set, will add CPU topology to the generated
        CPU.

Returns:
    lxml.etree.Element: CPU XML node

Raises:
    :exc:`~LagoInitException`: when failed to convert dict to XML