def generate_init(self, dst, out_format, vms_to_include, filters=None):
<EOL>with LogTask('<STR_LIT>'.format(dst)):<EOL><INDENT>if isinstance(out_format, plugins.output.DefaultOutFormatPlugin):<EOL><INDENT>out_format = plugins.output.YAMLOutFormatPlugin()<EOL><DEDENT>if not filters:<EOL><INDENT>filters = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>'<EOL>]<EOL><DEDENT>spec = self.get_env_spec(filters)<EOL>temp = {}<EOL>for vm in vms_to_include:<EOL><INDENT>temp[vm.name()] = spec['<STR_LIT>'][vm.name()]<EOL><DEDENT>spec['<STR_LIT>'] = temp<EOL>for _, domain in spec['<STR_LIT>'].viewitems():<EOL><INDENT>domain['<STR_LIT>'] = [<EOL>d for d in domain['<STR_LIT>'] if not d.get('<STR_LIT>')<EOL>]<EOL>for disk in domain['<STR_LIT>']:<EOL><INDENT>if disk['<STR_LIT:type>'] == '<STR_LIT>':<EOL><INDENT>disk['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>elif disk['<STR_LIT:type>'] == '<STR_LIT>':<EOL><INDENT>disk['<STR_LIT:type>'] = '<STR_LIT:file>'<EOL>disk['<STR_LIT>'] = '<STR_LIT:True>'<EOL><DEDENT>disk['<STR_LIT:path>'] = os.path.join(<EOL>'<STR_LIT>', os.path.basename(disk['<STR_LIT:path>'])<EOL>)<EOL><DEDENT><DEDENT>with open(dst, '<STR_LIT>') as f:<EOL><INDENT>if isinstance(out_format, plugins.output.YAMLOutFormatPlugin):<EOL><INDENT>f.write(yaml.safe_dump(spec))<EOL><DEDENT>else:<EOL><INDENT>f.write(out_format.format(spec))<EOL><DEDENT><DEDENT><DEDENT>
Generate an init file which represents this env and can
be used with the images created by self.export_vms
Args:
    dst (str): path and name of the new init file
    out_format (plugins.output.OutFormatPlugin):
        formatter for the output (the default is yaml)
    filters (list): list of paths to keys that should be removed from
        the init file
    vms_to_include (list of :class:lago.plugins.vm.VMPlugin):
        list of vms to include in the init file
Returns:
    None