def _reformat_host_networks(networks):
    """Reformat networks from list to dict.

    The key in the dict is the value of the key 'interface'
    in each network.

    Example: networks = [{'interface': 'eth0', 'ip': '10.1.1.1'}]
             is reformatted to {
                 'eth0': {'interface': 'eth0', 'ip': '10.1.1.1'}
             }

    Usage: The networks got from db api is a list of network,
           For better parsing in json frontend, we converted the
           format into dict to easy reference.
    """
    network_mapping = {}
    for network in networks:
        if 'interface' in network:
            network_mapping[network['interface']] = network
    return network_mapping