def provides_distribution(self, name, version=None):
matcher = None<EOL>if not version is None:<EOL><INDENT>try:<EOL><INDENT>matcher = self._scheme.matcher('<STR_LIT>' % (name, version))<EOL><DEDENT>except ValueError:<EOL><INDENT>raise DistlibException('<STR_LIT>' %<EOL>(name, version))<EOL><DEDENT><DEDENT>for dist in self.get_distributions():<EOL><INDENT>provided = dist.provides<EOL>for p in provided:<EOL><INDENT>p_name, p_ver = parse_name_and_version(p)<EOL>if matcher is None:<EOL><INDENT>if p_name == name:<EOL><INDENT>yield dist<EOL>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if p_name == name and matcher.match(p_ver):<EOL><INDENT>yield dist<EOL>break<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
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