<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def xrefs(self, nid, bidirectional=False):
 """ Fetches xrefs for a node Arguments --------- nid : str Node identifier for entity to be queried bidirection : bool If True, include nodes xreffed to nid Return ------ list[str] """

        if self.xref_graph is not None:
            xg = self.xref_graph
            if nid not in xg:
                return []
            if bidirectional:
                return list(xg.neighbors(nid))
            else:
                return [x for x in xg.neighbors(nid) if xg[nid][x][0]['source'] == nid]

        return []