<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def print_tools(self, pattern=None, buf=sys.stdout):
 """Print a list of visible tools. Args: pattern (str):
 Only list tools that match this glob pattern. """

        seen = set()
        rows = []

        context = self.context
        if context:
            data = context.get_tools()
            conflicts = set(context.get_conflicting_tools().keys())
            for _, (variant, tools) in sorted(data.items()):
                pkg_str = variant.qualified_package_name
                for tool in tools:
                    if pattern and not fnmatch(tool, pattern):
                        continue

                    if tool in conflicts:
                        label = "(in conflict)"
                        color = critical
                    else:
                        label = ''
                        color = None

                    rows.append([tool, '-', pkg_str, "active context", label, color])
                    seen.add(tool)

        for suite in self.suites:
            for tool, d in suite.get_tools().iteritems():
                if tool in seen:
                    continue
                if pattern and not fnmatch(tool, pattern):
                    continue

                label = []
                color = None
                path = which(tool)
                if path:
                    path_ = os.path.join(suite.tools_path, tool)
                    if path != path_:
                        label.append("(hidden by unknown tool '%s')" % path)
                        color = warning

                variant = d["variant"]
                if isinstance(variant, set):
                    pkg_str = ", ".join(variant)
                    label.append("(in conflict)")
                    color = critical
                else:
                    pkg_str = variant.qualified_package_name

                orig_tool = d["tool_name"]
                if orig_tool == tool:
                    orig_tool = '-'

                label = ' '.join(label)
                source = ("context '%s' in suite '%s'"
                          % (d["context_name"], suite.load_path))

                rows.append([tool, orig_tool, pkg_str, source, label, color])
                seen.add(tool)

        _pr = Printer(buf)
        if not rows:
            _pr("No matching tools.")
            return False

        headers = [["TOOL", "ALIASING", "PACKAGE", "SOURCE", "", None],
                   ["----", "--------", "-------", "------", "", None]]
        rows = headers + sorted(rows, key=lambda x: x[0].lower())
        print_colored_columns(_pr, rows)
        return True