<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def xor_key(first, second, trafaret):
 """ xor_key - takes `first` and `second` key names and `trafaret`. Checks if we have only `first` or only `second` in data, not both, and at least one. Then checks key value against trafaret. """

    trafaret = t.Trafaret._trafaret(trafaret)

    def check_(value):
        if (first in value) ^ (second in value):
            key = first if first in value else second
            yield first, t.catch_error(trafaret, value[key]), (key,)
        elif first in value and second in value:
            yield first, t.DataError(error='correct only if {} is not defined'.format(second)), (first,)
            yield second, t.DataError(error='correct only if {} is not defined'.format(first)), (second,)
        else:
            yield first, t.DataError(error='is required if {} is not defined'.format('second')), (first,)
            yield second, t.DataError(error='is required if {} is not defined'.format('first')), (second,)

    return check_