def two_phase_session(engine_map, versioned=True):
 session = Session(binds=engine_map, twophase=True, autoflush=True, autocommit=False)
 if versioned:
  session = configure_versioning(session)
 return session

def two_phase_session ( engine_map , versioned = True ) : session = Session ( binds = engine_map , twophase = True , autoflush = True , autocommit = False ) if versioned : session = configure_versioning ( session ) return session
returns a session that implements two-phase-commit .