def _executeReservationCallback(self, data):
        if len(data) == 0:
            raise Exception("Could not find reservation.")
        uuid = data.keys()[0]
        kwargs_raw = {}
        reserved_arguments = {}
        # Load attributes into dicts for use by the system or custom functions.
        for key in data[uuid]:
            if key in self.reserved_arguments:
                reserved_arguments[key] = data[uuid][key][0]
            else:
                kwargs_raw[key] = data[uuid][key][0]
        # Check to make sure the custom function is present.
        function_name = reserved_arguments["reservation_function_name"]
        if function_name not in self.functions:
            raise Exception("Unable to process function %s for UUID: %s" % (function_name, uuid))
            return
        # Check for the presence of all required system attributes.
        if "reservation_function_name" not in reserved_arguments:
            self.deleteReservation(uuid)
            raise Exception("Reservation %s does not have a function name." % uuid)
        if "reservation_created" not in reserved_arguments:
            self.deleteReservation(uuid, function_name=function_name)
            raise Exception("Reservation %s, %s does not have a created time." % (function_name, uuid))
        if "reservation_next_request" not in reserved_arguments:
            self.deleteReservation(uuid, function_name=function_name)
            raise Exception("Reservation %s, %s does not have a next request time." % (function_name, uuid))
        if "reservation_error" not in reserved_arguments:
            self.deleteReservation(uuid, function_name=function_name)
            raise Exception("Reservation %s, %s does not have an error flag." % (function_name, uuid))
        # Load custom function.
        if function_name in self.functions:
            exposed_function = self.functions[function_name]
        else:
            raise Exception("Could not find function %s." % function_name)
            return
        # Check for required / optional arguments.
        kwargs = {}
        for key in kwargs_raw:
            if key in exposed_function["required_arguments"]:
                kwargs[key] = kwargs_raw[key]
            if key in exposed_function["optional_arguments"]:
                kwargs[key] = kwargs_raw[key]
        has_reqiured_arguments = True
        for key in exposed_function["required_arguments"]:
            if key not in kwargs:
                has_reqiured_arguments = False
                raise Exception("%s, %s does not have required argument %s." % (function_name, uuid, key))
        LOGGER.debug("Executing function.\n%s" % function_name)
        return self.callExposedFunction(exposed_function["function"], kwargs, function_name, uuid=uuid)
dataset/ETHPy150Open wehriam/awspider/awspider/servers/interface.py/InterfaceServer._executeReservationCallback/original