def get(self, device_id):

        sessionlist = Session.getSessionsByDevice(device_id)
        if (isinstance(sessionlist, list)):
            sessionlistofdicts = [session.toDict() for session in sessionlist]
            response = {}
            response['sessionlist'] = sessionlistofdicts
            response['result'] = True
            return jsonify(response)
        else:
            response = {}
            response['msg'] = sessionlist
            response['result'] = False
            return jsonify(response)
    def delete(self, device_id):
        s = Session.getSessionsByDevice(device_id)
        if not (isinstance(s, list)):
            response = {}
            response['msg'] = s
            response['result'] = False
            return jsonify(response)

        r = Session.deleteSessionsByDevice(device_id)
        if (r == False):
            response = {}
            response['msg'] = "Sessions Deletion Unsuccessful."
            response['result'] = False
            return jsonify(response)
        else:
            response = {}
            response['msg'] = "Sessions deleted successfully."
            response['result'] = True
            return jsonify(response)