<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def subdict(name, *keys, **kw):
 """ Subdict key. Takes a `name`, any number of keys as args and keyword argument `trafaret`. Use it like: def check_passwords_equal(data):
 if data['password'] != data['password_confirm']: return t.DataError('Passwords are not equal') return data['password'] passwords_key = subdict( 'password', t.Key('password', trafaret=check_password), t.Key('password_confirm', trafaret=check_password), trafaret=check_passwords_equal, ) signup_trafaret = t.Dict( t.Key('email', trafaret=t.Email), passwords_key, ) """

    trafaret = kw.pop('trafaret')  # coz py2k

    def inner(data, context=None):
        errors = False
        preserve_output = []
        touched = set()
        collect = {}
        for key in keys:
            for k, v, names in key(data, context=context):
                touched.update(names)
                preserve_output.append((k, v, names))
                if isinstance(v, t.DataError):
                    errors = True
                else:
                    collect[k] = v
        if errors:
            for out in preserve_output:
                yield out
        elif collect:
            yield name, t.catch(trafaret, collect), touched

    return inner