def disconnect(database=None):
    database = database or proxy_database
    try:
        database.connection.close()
    except AttributeError:
        if not osfsettings.DEBUG_MODE:
            logger.error('MongoDB client not attached to request.')
dataset/ETHPy150Open CenterForOpenScience/osf.io/framework/transactions/commands.py/disconnect/original