<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def build_transitive_closure(self, rel, tc_dict):
 """Build a transitive closure for a given relation in a given dict."""

        # Make a function with the righ argument structure
        rel_fun = lambda node, graph: rel(node)
        for x in self.graph.all_nodes():
            rel_closure = self.graph.transitiveClosure(rel_fun, x)
            xs = x.toPython()
            for y in rel_closure:
                ys = y.toPython()
                if xs == ys:
                    continue
                try:
                    tc_dict[xs].append(ys)
                except KeyError:
                    tc_dict[xs] = [ys]
                if rel == self.isa_or_partof_objects:
                    self._add_component(xs, ys)