<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def resolve(self):
 """Builds all targets of this dependency and returns the result of self.function on the resulting values """

        values = {}
        for target_name in self.target_names:
            if self.context.is_build_needed(self.parent, target_name):
                self.context.build_task(target_name)

            if len(self.keyword_chain) == 0:
                values[target_name] = self.context.tasks[target_name].value
            else:
                values[target_name] = reduce(
                    lambda task, name: getattr(task, name),
                    self.keyword_chain,
                    self.context.tasks[target_name].task)
        return self.function(**values)