def validator(f):
    return f

@@ -1,31 +1,498 @@
-def validator(f):%0A    return f
+import functools%0A%0A%0A_undefined = object()%0A%0A%0Adef validator(f):%0A    @functools.wraps(f)%0A    def wrapper(value=_undefined, **kwargs):%0A        required = kwargs.pop('required', True)%0A%0A        def validate(value_):%0A            if value_ is None:%0A                if required:%0A                    raise TypeError()%0A                return%0A            f(value, **kwargs)%0A%0A        if value is not _undefined:%0A            validate(value, **kwargs)%0A        else:%0A            return validate%0A%0A    return wrapper
 %0A

Implement `validator` decorator.