def intify(base): def inner(string): left, right = re.split('[^0-9]', string, 1) return sympy.Integer(int(right, base) * (base ** int(left))) return inner