<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parents(self, node, relations=None):
 """ Return all direct parents of specified node. Wraps networkx by default. Arguments --------- node: string identifier for node in ontology relations: list of strings list of relation (object property) IDs used to filter """

        g = self.get_graph()
        if node in g:
            parents = list(g.predecessors(node))
            if relations is None:
                return parents
            else:
                rset = set(relations)
                return [p for p in parents if len(self.child_parent_relations(node, p, graph=g).intersection(rset)) > 0 ]
        else:
            return []