human
Write me a the Python code you requested given the following:
Complete the below
@directive('conflicts')
def conflicts(conflict_spec, when=None):

    ''''Allows a package to define a conflict.
    Currently, a "conflict" is a concretized configuration that is known
    to be non-valid. For example, a package that is known not to be
    buildable with intel compilers can declare::
    conflicts(\'%intel\')
    To express the same constraint only when the \'foo\' variant is
    activated::
    conflicts(\'%intel\', when=\'+foo\')
    Args:
    conflict_spec (Spec): constraint defining the known conflict
    when (Spec): optional constraint that triggers the conflict'
    '''
assistant
#Here is the Python code you requested.
    def _execute(pkg):
        condition = (pkg.name if (when is None) else when)
        when_spec = parse_anonymous_spec(condition, pkg.name)
        when_spec_list = pkg.conflicts.setdefault(conflict_spec, [])
        when_spec_list.append(when_spec)
    return _execute