'Determine & return which networks an instance should connect to.'

def _get_networks_for_instance(self, context, instance_id, project_id, requested_networks=None):

    if ((requested_networks is not None) and (len(requested_networks) != 0)):
        network_uuids = [request.network_id for request in requested_networks]
        networks = self._get_networks_by_uuids(context, network_uuids)
    else:
        try:
            networks = objects.NetworkList.get_all(context)
        except exception.NoNetworksFound:
            return []
    return [network for network in networks if (not network.vlan)]
