def _normalize_to_unit(self, value, unit):
        """Normalize the value to the unit returned.

        We use base-1000 for second-based units, and base-1024 for
        byte-based units. Sadly, the Nagios-Plugins specification doesn't
        disambiguate base-1000 (KB) and base-1024 (KiB).
        """
        if unit == 'ms':
            return value / 1000.0
        if unit == 'us':
            return value / 1000000.0
        if unit == 'KB':
            return value * 1024
        if unit == 'MB':
            return value * 1024 * 1024
        if unit == 'GB':
            return value * 1024 * 1024 * 1024
        if unit == 'TB':
            return value * 1024 * 1024 * 1024 * 1024

        return value
Normalize the value to the unit returned.

        We use base-1000 for second-based units, and base-1024 for
        byte-based units. Sadly, the Nagios-Plugins specification doesn't
        disambiguate base-1000 (KB) and base-1024 (KiB).
        
src/collectors/nagiosperfdata/nagiosperfdata.py