'Check if the container is connected to non-requested networks'

def has_extra_networks(self):

    extra_networks = []
    extra = False
    if (not self.container.get('NetworkSettings')):
        self.fail('has_extra_networks:    Error    parsing    container    properties.    NetworkSettings    missing.')
    connected_networks = self.container['NetworkSettings'].get('Networks')
    if connected_networks:
        for (network, network_config) in connected_networks.iteritems():
            keep = False
            if self.parameters.networks:
                for expected_network in self.parameters.networks:
                    if (expected_network['name'] == network):
                        keep = True
            if (not keep):
                extra = True
                extra_networks.append(dict(name=network, id=network_config['NetworkID']))
    return (extra, extra_networks)
