def clear_expired_sessions():
 for sid in get_expired_sessions():
  delete_session(sid, reason=u'Session Expired')

def clear_expired_sessions ( ) : for sid in get_expired_sessions ( ) : delete_session ( sid , reason = u'Session Expired' )
this function is meant to be called from scheduler .