def get_expired_sessions():
 expired = []
 for device in (u'desktop', u'mobile'):
  expired += frappe.db.sql_list(u'select sid from tabSessions\n DCTB  DCTB  DCTB  DCTB where TIMEDIFF(NOW(), lastupdate) > TIME(%s)\n DCTB  DCTB  DCTB  DCTB and device = %s', (get_expiry_period(device), device))
 return expired

def get_expired_sessions ( ) : expired = [ ] for device in ( u'desktop' , u'mobile' ) : expired += frappe . db . sql_list ( u'select sid from tabSessions\n DCTB  DCTB  DCTB  DCTB where TIMEDIFF(NOW(), lastupdate) > TIME(%s)\n DCTB  DCTB  DCTB  DCTB and device = %s' , ( get_expiry_period ( device ) , device ) ) return expired
returns list of expired sessions .