def frame_relations(self, frame=None, frame2=None, type=None):
        relation_type = type

        if not self._frel_idx:
            self._buildrelationindex()

        rels = None

        if relation_type is not None:
            if not isinstance(relation_type, dict):
                type = [rt for rt in self.frame_relation_types() if rt.name==type][0]
                assert isinstance(type,dict)

        # lookup by 'frame'
        if frame is not None:
            if isinstance(frame,dict) and 'frameRelations' in frame:
                rels = PrettyList(frame.frameRelations)
            else:
                if not isinstance(frame, int):
                    if isinstance(frame, dict):
                        frame = frame.ID
                    else:
                        frame = self.frame_by_name(frame).ID
                rels = [self._frel_idx[frelID] for frelID in self._frel_f_idx[frame]]

            # filter by 'type'
            if type is not None:
                rels = [rel for rel in rels if rel.type is type]
        elif type is not None:
            # lookup by 'type'
            rels = type.frameRelations
        else:
            rels = self._frel_idx.values()

        # filter by 'frame2'
        if frame2 is not None:
            if frame is None:
                raise FramenetError("frame_relations(frame=None, frame2=<value>) is not allowed")
            if not isinstance(frame2, int):
                if isinstance(frame2, dict):
                    frame2 = frame2.ID
                else:
                    frame2 = self.frame_by_name(frame2).ID
            if frame==frame2:
                raise FramenetError("The two frame arguments to frame_relations() must be different frames")
            rels = [rel for rel in rels if rel.superFrame.ID==frame2 or rel.subFrame.ID==frame2]

        return PrettyList(sorted(rels,
                key=lambda frel: (frel.type.ID, frel.superFrameName, frel.subFrameName)))
Return a li item.
dataset/ETHPy150Open nltk/nltk/nltk/corpus/reader/framenet.py/FramenetCorpusReader.frame_relations--crossover with--dataset/ETHPy150Open mitsuhiko/fungiform/fungiform/widgets.py/Checkbox.as_li