<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def confirm_key(name, confirm_name, trafaret):
 """ confirm_key - takes `name`, `confirm_name` and `trafaret`. Checks if data['name'] equals data['confirm_name'] and both are valid against `trafaret`. """

    def check_(value):
        first, second = None, None
        if name in value:
            first = value[name]
        else:
            yield name, t.DataError('is required'), (name,)
        if confirm_name in value:
            second = value[confirm_name]
        else:
            yield confirm_name, t.DataError('is required'), (confirm_name,)
        if not (first and second):
            return
        yield name, t.catch_error(trafaret, first), (name,)
        yield confirm_name, t.catch_error(trafaret, second), (confirm_name,)
        if first != second:
            yield confirm_name, t.DataError('must be equal to {}'.format(name)), (confirm_name,)
    return check_