

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 ValueError:
                    p = 0
                return (int(m.group('number')) * (1024 ** m))
    return 0

dataset/ETHPy150Open MirantisWorkloadMobility/CloudFerry/cloudferry/lib/utils/sizeof_format.py parse_size/VarMisuse@132/151 `p`->`m`