human
I wrote the below code

    def decorator(func):
        def wrapper(*args, **kwargs):
            if kwargs.get(u'session'):
                return func(*args, **kwargs)
            with _Session() as session:
                kwargs[u'session'] = session
                return func(*args, **kwargs)
        return wrapper
    if ((len(args) == 1) and (not kwargs) and callable(args[0])):
        _Session = functools.partial(Session, expire_on_commit=False)
        return decorator(args[0])
    else:
        _Session = functools.partial(Session, *args, **kwargs)
        return decorator

What's a good function header?
 ... Here's a good function header?
assistant
#Here's a good function header.

def with_session(*args, **kwargs):