def METHOD_NAME():
    if engine:
        return engine
    elif scoped_session and scoped_session().bind:
        return scoped_session().bind
    elif metadata and metadata.bind:
        return metadata.bind
    else:
        return None