def get_inventory_str(self, keys=None):
inventory = self.get_inventory(keys)<EOL>lines = []<EOL>for name, hosts in inventory.viewitems():<EOL><INDENT>lines.append('<STR_LIT>'.format(name=name))<EOL>for host in sorted(hosts):<EOL><INDENT>lines.append(host)<EOL><DEDENT><DEDENT>return '<STR_LIT:\n>'.join(lines)<EOL>
Convert a dict generated by ansible.LagoAnsible.get_inventory
to an INI-like file.

Args:
    keys (list of str): Path to the keys that will be used to
        create groups.

Returns:
    str: INI-like Ansible inventory