human
Solve the following python programming problem given the following code:
@directive('provided')
def provides(*specs, **kwargs):
assistant
#Here is the Python program you requested.

    """Allows packages to provide a virtual dependency.  If a package provides
    \mpi\, other packages can declare that they depend on "mpi", and spack
    can use the providing package to satisfy the dependency.
    """
    def _execute(pkg):
        spec_string = kwargs.get('when', pkg.name)
        provider_spec = parse_anonymous_spec(spec_string, pkg.name)
        for string in specs:
            for provided_spec in spack.spec.parse(string):
                if (pkg.name == provided_spec.name):
                    raise CircularReferenceError('depends_on', pkg.name)
                if (provided_spec not in pkg.provided):
                    pkg.provided[provided_spec] = set()
                pkg.provided[provided_spec].add(provider_spec)
    return _execute