docs: def generate_inventory(roles, networks, inventory_path, check_networks=False,
                         fake_interfaces=None, fake_networks=None):
      """Generate an inventory file in the ini format.
  
      The inventory is generated using the ``roles`` in the ``ini`` format.  If
      ``check_network == True``, the function will try to discover which networks
      interfaces are available and map them to one network of the ``networks``
      parameters.  Note that this auto-discovery feature requires the servers to
      have their IP set.
  
      Args:
          roles (dict): role->hosts mapping as returned by
              :py:meth:`enoslib.infra.provider.Provider.init`
          networks (list): network list as returned by
              :py:meth:`enoslib.infra.provider.Provider.init`
          inventory_path (str): path to the inventory to generate
          check_networks (bool): True to enable the auto-discovery of the mapping
              interface name <-> network role
          fake_interfaces (list): names of optionnal dummy interfaces to create
              on the nodes
          fake_networks (list): names of the roles to associate with the fake
              interfaces. Like reguilar network interfaces, the mapping will be
              added to the host vars. Internally this will be zipped with the
              fake_interfaces to produce the mapping. """
  
      with open(inventory_path, "w") as f:
          f.write(_generate_inventory(roles))
  
      if check_networks:
          discover_networks(
              roles,
              networks,
              fake_interfaces=fake_interfaces,
              fake_networks=fake_networks
          )
          with open(inventory_path, "w") as f:
              f.write(_generate_inventory(roles))