def METHOD_NAME(engine):
    from sqlalchemy.orm import sessionmaker, scoped_session
    connection = engine.connect()
    trans = connection.begin()
    session_factory = sessionmaker(bind=engine)
    # make session thread-local to avoid problems with sqlite (see #275)
    METHOD_NAME = scoped_session(session_factory)
    yield METHOD_NAME
    METHOD_NAME.close()
    trans.rollback()
    connection.close()