@staticmethod
def _unit_to_bytes(unit):
    """Return the value of an unit."""
    if not unit:
        return 1
    unit = unit.upper()
    if unit.startswith('KI'):
        return 1024
    elif unit.startswith('K'):
        return 1000
    elif unit.startswith('MI'):
        return 1048576
    elif unit.startswith('M'):
        return 1000000
    elif unit.startswith('GI'):
        return 1073741824
    elif unit.startswith('G'):
        return 1000000000
    elif unit.startswith('TI'):
        return 1099511627776
    elif unit.startswith('T'):
        return 1000000000000
    else:
        return 1
