'to_dict toolbox.'

def to_dict(self, trans, in_panel=True, **kwds):

    if in_panel:
        panel_elts = list(self.tool_panel_contents(trans, **kwds))
        rval = []
        kwargs = dict(trans=trans, link_details=True)
        for elt in panel_elts:
            rval.append(elt.to_dict(**kwargs))
    else:
        filter_method = self._build_filter_method(trans)
        tools = []
        for (id, tool) in self._tools_by_id.items():
            tool = filter_method(tool, panel_item_types.TOOL)
            if (not tool):
                continue
            tools.append(tool.to_dict(trans, link_details=True))
        rval = tools
    return rval
