'Find provider for a virtual spec in the provider index.
Raise an exception if there is a conflicting virtual
dependency already in this spec.'

def _find_provider(self, vdep, provider_index):

    assert vdep.virtual
    providers = provider_index.providers_for(vdep)
    if providers:
        for provider in providers:
            for spec in providers:
                if ((spec is not provider) and provider.satisfies(spec)):
                    providers.remove(spec)
        if (len(providers) > 1):
            raise MultipleProviderError(vdep, providers)
        return providers[0]
    else:
        required = provider_index.providers_for(vdep.name)
        if (len(required) > 1):
            raise MultipleProviderError(vdep, required)
        elif required:
            raise UnsatisfiableProviderSpecError(required[0], vdep)
