docs: def discover_networks(roles, networks, fake_interfaces=None,
                      fake_networks=None):
      """Checks the network interfaces on the nodes.
  
      This enables to auto-discover the mapping interface name <-> network role.
      Beware, this has a side effect on each Host in roles.
  
      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`
          fake_interfaces (list): names of optionnal dummy interfaces to create
          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.
  
      If the command is successful each host will be added some variables.
      Assuming that one network whose role is `mynetwork` has been declared, the
      following variables will be available through the ansible hostvars:
  
      - ``mynetwork=eth1``, `eth1` has been discovered has the interface in the
        network `mynetwork`.
      - ``mynetwork_dev=eth1``, same as above with a different accessor names
      - ``mynetwork_ip=192.168.42.42``, this indicates the ip in the network
        `mynetwork` for this node
  
      All of this variable can then be accessed by the other nodes through the
      hostvars: ``hostvars[remote_node]["mynetwork_ip"]``
      """
  
      def get_devices(facts):
          """Extract the network devices information from the facts."""
          devices = []
          for interface in facts['ansible_interfaces']:
              ansible_interface = 'ansible_' + interface
              # filter here (active/ name...)
              if 'ansible_' + interface in facts:
                  interface = facts[ansible_interface]
                  devices.append(interface)
          return devices
  
      wait_ssh(roles)
      tmpdir = os.path.join(os.getcwd(), TMP_DIRNAME)
      _check_tmpdir(tmpdir)
      fake_interfaces = fake_interfaces or []
      fake_networks = fake_networks or []
  
      utils_playbook = os.path.join(ANSIBLE_DIR, 'utils.yml')
      facts_file = os.path.join(tmpdir, 'facts.json')
      options = {
          'enos_action': 'check_network',
          'facts_file': facts_file,
          'fake_interfaces': fake_interfaces
      }
      run_ansible([utils_playbook], roles=roles,
          extra_vars=options,
          on_error_continue=False)
  
      # Read the file
      # Match provider networks to interface names for each host
      with open(facts_file) as f:
          facts = json.load(f)
          for _, host_facts in facts.items():
              host_nets = _map_device_on_host_networks(networks,
                                                      get_devices(host_facts))
              # Add the mapping : networks <-> nic name
              host_facts['networks'] = host_nets
  
      # Finally update the env with this information
      # generate the extra_mapping for the fake interfaces
      extra_mapping = dict(zip(fake_networks, fake_interfaces))
      _update_hosts(roles, facts, extra_mapping=extra_mapping)