<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parent_index(self, relations=None):
 """ Returns a mapping of nodes to all direct parents Arguments --------- relations : list[str] list of relations used to filter Returns: list """

        g = None
        if relations is None:
            g = self.get_graph()
        else:
            g = self.get_filtered_graph(relations)
        l = []
        for n in g:
            l.append([n] + list(g.predecessors(n)))
        return l