public function formatStats($stats, $debug = false)
    {
        if (!is_array($stats)) {
            return "No statistics returned.\n";
        }

        if (count($stats) == 0) {
            return "No statistics returned.\n";
        }

        $out = "Servers found: " . count($stats) . "\n\n";
        foreach ($stats as $host => $item) {
            if (!is_array($item) || count($item) == 0) {
                $out .= "  <error>" . $host . "</error>\n";

                continue;
            }

            $out .= "<info>Host:\t" . $host . "</info>\n";

            $out .= "\tUsage: " . $this->formatUsage($item['bytes'], $item['limit_maxbytes']) . "\n";
            $out .= "\tUptime: " . $this->formatUptime($item['uptime']) . "\n";
            $out .= "\tOpen Connections: " . $item['curr_connections'] . "\n";
            $out .= "\tHits: " . $item['get_hits'] . "\n";
            $out .= "\tMisses: " . $item['get_misses'] . "\n";
            if ($item['get_hits'] + $item['get_misses'] > 0) {
                $out .= "\tHelpfulness: " . round(
                    $item['get_hits'] / ($item['get_hits'] + $item['get_misses']) * 100,
                    2
                ) . "%\n";
            }

            if ($debug) {
                $out .= "\n";
                foreach ($item as $key => $value) {
                    $out .= "\t" . $key . ': ' . $value . "\n";
                }
            }
        }

        return $out;
    }