Return a list of dictionaries suitable to be used with ptrie module.

def _get_exceptions_db(self):
        """Return a list of dictionaries suitable to be used with ptrie module."""
        template = "{extype} ({exmsg}){raised}"
        if not self._full_cname:
            # When full callable name is not used the calling path is
            # irrelevant and there is no function associated with an
            # exception
            ret = []
            for _, fdict in self._ex_dict.items():
                for key in fdict.keys():
                    ret.append(
                        {
                            "name": fdict[key]["name"],
                            "data": template.format(
                                extype=_ex_type_str(key[0]),
                                exmsg=key[1],
                                raised="*" if fdict[key]["raised"][0] else "",
                            ),
                        }
                    )
            return ret
        # When full callable name is used, all calling paths are saved
        ret = []
        for fdict in self._ex_dict.values():
            for key in fdict.keys():
                for func_name in fdict[key]["function"]:
                    rindex = fdict[key]["function"].index(func_name)
                    raised = fdict[key]["raised"][rindex]
                    ret.append(
                        {
                            "name": self.decode_call(func_name),
                            "data": template.format(
                                extype=_ex_type_str(key[0]),
                                exmsg=key[1],
                                raised="*" if raised else "",
                            ),
                        }
                    )
        return ret