def create_session(event_id, serial_no='', **kwargs):
 kwargs['track'] = Track.query.get(kwargs.get('track', 555))
 kwargs['microlocation'] = Microlocation.query.get(kwargs.get('microlocation', 555))
 kwargs['session_type'] = SessionType.query.get(kwargs.get('session_type', 555))
 kwargs['speakers'] = [Speaker.query.get(i) for i in kwargs['speakers'] if (Speaker.query.get(i) is not None)]
 session = Session(title=('TestSession%d_%s' % (event_id, serial_no)), long_abstract='descp', start_time=kwargs.get('start_time', datetime(2014, 8, 4, 12, 45, 0)), end_time=datetime(2014, 8, 4, 13, 0, 0), event_id=event_id, **kwargs)
 save_to_db(session, 'Session saved', print_error=False)

def create_session ( event_id , serial_no = '' , ** kwargs ) : kwargs [ 'track' ] = Track . query . get ( kwargs . get ( 'track' , 555 ) ) kwargs [ 'microlocation' ] = Microlocation . query . get ( kwargs . get ( 'microlocation' , 555 ) ) kwargs [ 'session_type' ] = SessionType . query . get ( kwargs . get ( 'session_type' , 555 ) ) kwargs [ 'speakers' ] = [ Speaker . query . get ( i ) for i in kwargs [ 'speakers' ] if ( Speaker . query . get ( i ) is not None ) ] session = Session ( title = ( 'TestSession%d_%s' % ( event_id , serial_no ) ) , long_abstract = 'descp' , start_time = kwargs . get ( 'start_time' , datetime ( 2014 , 8 , 4 , 12 , 45 , 0 ) ) , end_time = datetime ( 2014 , 8 , 4 , 13 , 0 , 0 ) , event_id = event_id , ** kwargs ) save_to_db ( session , 'Session saved' , print_error = False )
creates session with track ids and stuff .