'Attempt to remove the tool identified by \'tool_id\'. Ignores
tool lineage - so to remove a tool with potentially multiple
versions send remove_from_panel=False and handle the logic of
promoting the next newest version of the tool into the panel
if needed.'

def remove_tool_by_id(self, tool_id, remove_from_panel=True):

    if (tool_id not in self._tools_by_id):
        message = ('No    tool    with    id    %s' % escape(tool_id))
        status = 'error'
    else:
        tool = self._tools_by_id[tool_id]
        del self._tools_by_id[tool_id]
        tool_cache = getattr(self.app, 'tool_cache', None)
        if tool_cache:
            tool_cache.expire_tool(tool_id)
        if remove_from_panel:
            tool_key = ('tool_' + tool_id)
            for (key, val) in self._tool_panel.items():
                if (key == tool_key):
                    del self._tool_panel[key]
                    break
                elif key.startswith('section'):
                    if (tool_key in val.elems):
                        del self._tool_panel[key].elems[tool_key]
                        break
            if (tool_id in self.data_manager_tools):
                del self.data_manager_tools[tool_id]
        message = 'Removed    the    tool:<br/>'
        message += ('<b>name:</b>    %s<br/>' % escape(tool.name))
        message += ('<b>id:</b>    %s<br/>' % escape(tool.id))
        message += ('<b>version:</b>    %s' % escape(tool.version))
        status = 'done'
    return (message, status)
