'Iterates over all distributions to find which distributions provide *name*.
If a *version* is provided, it will be used to filter the results.
This function only returns the first result found, since no more than
one values are expected. If the directory is not found, returns ``None``.
:parameter version: a version specifier that indicates the version
required, conforming to the format in ``PEP-345``
:type name: string
:type version: string'

def provides_distribution(self, name, version=None):

    matcher = None
    if (not (version is None)):
        try:
            matcher = self._scheme.matcher((u'%s    (%s)' % (name, version)))
        except ValueError:
            raise DistlibException((u'invalid    name    or    version:    %r,    %r' % (name, version)))
    for dist in self.get_distributions():
        provided = dist.provides
        for p in provided:
            (p_name, p_ver) = parse_name_and_version(p)
            if (matcher is None):
                if (p_name == name):
                    (yield dist)
                    break
            elif ((p_name == name) and matcher.match(p_ver)):
                (yield dist)
                break
