def get_tool_class(self, tool):
        if isinstance(tool, string_types):
            tool_id = StreamId(tool)
        elif isinstance(tool, StreamId):
            tool_id = tool
        else:
            raise TypeError(tool)
        tool_stream_view = None
        if tool_id in self.tools:
            tool_stream_view = self.tools[tool_id].window((MIN_DATE, self.tools.up_to_timestamp))
        else:
            for tool_channel in self.tool_channels:
                if tool_channel == self.tools:
                    continue
                if tool_id in tool_channel:
                    tool_stream_view = tool_channel[tool_id].window((MIN_DATE, tool_channel.up_to_timestamp))
        if tool_stream_view is None:
            raise ToolNotFoundError(tool)
        last = tool_stream_view.last()
        if last is None:
            raise ToolNotFoundError(tool)
        return tool_stream_view.last().value