def decorator(wrapped_decorator):
def helper(_func=None, **options):<EOL><INDENT>def outer_wrapper(func):<EOL><INDENT>@wrapping(func)<EOL>def inner_wrapper(*args, **kwds):<EOL><INDENT>return wrapped_decorator(func, args, kwds, **options)<EOL><DEDENT>return inner_wrapper<EOL><DEDENT>if _func is None:<EOL><INDENT>return outer_wrapper<EOL><DEDENT>if options:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>return outer_wrapper(_func)<EOL><DEDENT>helper.wrapped_decorator = wrapped_decorator<EOL>return helper<EOL>
Converts a function into a decorator that optionally accepts keyword
    arguments in its declaration.

    Example usage:
      @utils.decorator
      def decorator(func, args, kwds, op1=None):
        ... apply op1 ...
        return func(*args, **kwds)

      # Form (1), vanilla
      @decorator
      foo(...)
        ...

      # Form (2), with options
      @decorator(op1=5)
      foo(...)
        ...

    Args:
      wrapped_decorator: A function that accepts positional args (func, args,
        kwds) and any additional supported keyword arguments.

    Returns:
      A decorator with an additional 'wrapped_decorator' property that is set to
    the original function.