def _get_size_from_memory(self, memory):
        res = re.match(r'(\d+)(.*)', memory.lower())
        if not res:
            raise InputErrorException('InvalidMemory')
        if res.group(2) in ['mb', 'm', '']:
            size = float(res.group(1)) / 128
        elif res.group(2) in ['gb', 'g']:
            size = float(res.group(1)) * 2 ** 10 / 128
        else:
            raise InputErrorException('InvalidMemory')
        final_size = int(math.ceil(size))
        if final_size != size:
            print >> sys.stderr, 'Memory size has to be a multiple of 128MB and has been rounded up to {0}MB.'.format(final_size * 128)
        return final_size
dataset/ETHPy150Open cloudControl/cctrl/cctrl/app.py/AppController._get_size_from_memory/original