if args and args.get('application_session_id'):
        s = s.where(ApplicationSession.id == args.get('application_session_id'))