def parse_size(size):
    if isinstance(size, (int, long)):
        return max((0, size))
    if isinstance(size, basestring):
        size = size.upper()
        if size == 'OFF':
            return 0
        else:
            m = RE_SIZE.match(size)
            if m:
                try:
                    p = UNITS.index(m.group('unit')[:1])
                except __HOLE__:
                    p = 0
                return int(m.group('number')) * 1024 ** p
    return 0
dataset/ETHPy150Open MirantisWorkloadMobility/CloudFerry/cloudferry/lib/utils/sizeof_format.py/parse_size