def optional_arg_class_decorator(fn):
@functools.wraps(fn)<EOL>def wrapped_decorator(*args, **kwargs):<EOL><INDENT>if len(args) == <NUM_LIT:1> and isinstance(args[<NUM_LIT:0>], type) and not kwargs:<EOL><INDENT>return fn(args[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>def real_decorator(decoratee):<EOL><INDENT>return fn(decoratee, *args, **kwargs)<EOL><DEDENT>return real_decorator<EOL><DEDENT><DEDENT>return wrapped_decorator<EOL>
Based on:
https://stackoverflow.com/questions/3888158/python-making-decorators-with-optional-arguments