public static function format($size, $decimals = 2, $decPoint = '.', $thousandsSep = '', $unitSep = '')
    {
        $output = $unit = null;
        foreach (self::getBinarySizes() as $unit => $divider) {
            $output = $size / $divider;
            if ($output < 1000) {
                break;
            }
        }
        if (null === $output) {
            throw new \UnexpectedValueException("Unable to parse value: '{$size}'");
        }
        $unit = $unit === 'o' ? 'o' : ucfirst($unit);
        $trimmed = rtrim(rtrim(number_format($output, $decimals, $decPoint, $thousandsSep), '0'), $decPoint);
        $formatted = $trimmed.$unitSep.$unit;

        return str_replace(' ', utf8_encode(chr(160)), $formatted);
    }