human
Complete this python program:
def autocommit(using=None):
assistant
#Here is the Python code you requested.

    """Decorator that activates commit on save. This is Django\s default behavior;
    this decorator is useful if you globally activated transaction management in
    your settings file and want the default behavior in some view functions.
    """
    def inner_autocommit(func, db=None):
        def _autocommit(*args, **kw):
            try:
                enter_transaction_management(managed=False, using=db)
                managed(False, using=db)
                return func(*args, **kw)
            finally:
                leave_transaction_management(using=db)
        return wraps(func)(_autocommit)
    if (using is None):
        using = DEFAULT_DB_ALIAS
    if callable(using):
        return inner_autocommit(using, DEFAULT_DB_ALIAS)
    return (lambda func: inner_autocommit(func, using))