def db_monodb(httprequest=None):
 httprequest = (httprequest or request.httprequest)
 dbs = db_list(True, httprequest)
 db_session = httprequest.session.db
 if (db_session in dbs):
  return db_session
 if (len(dbs) == 1):
  return dbs[0]
 return None

def db_monodb ( httprequest = None ) : httprequest = ( httprequest or request . httprequest ) dbs = db_list ( True , httprequest ) db_session = httprequest . session . db if ( db_session in dbs ) : return db_session if ( len ( dbs ) == 1 ) : return dbs [ 0 ] return None
magic function to find the current database .