def _repr_pretty_(self, p, cycle):
        """method that defines ``Struct``'s pretty printing rules for iPython

        Args:
            p (IPython.lib.pretty.RepresentationPrinter): pretty printer object
            cycle (bool): is ``True`` if pretty detected a cycle
        """
        if cycle:
            p.text('Chainer(...)')
        else:
            with p.group(8, 'Chainer[', ']'):
                reversed_components_dict = {v: k for k, v in self._components_dict.items()
                                            if isinstance(v, Hashable)}
                # p.pretty(self.__prepare_repr())
                for i, (in_params, out_params, component) in enumerate(self.train_pipe):
                    if i > 0:
                        p.text(',')
                        p.breakable()
                    if isinstance(component, Hashable) and component in reversed_components_dict:
                        p.pretty(reversed_components_dict[component])
                        p.text(': ')
                    else:
                        for k, v in self._components_dict.items():
                            if v is component:
                                p.pretty(k)
                                p.text(': ')
                                break
                    p.pretty(component)
method that defines ``Struct``'s pretty printing rules for iPython

        Args:
            p (IPython.lib.pretty.RepresentationPrinter): pretty printer object
            cycle (bool): is ``True`` if pretty detected a cycle
        
deeppavlov/core/common/chainer.py