def safe_lshift(a, b):
    """safe version of lshift"""
    if b > MAX_SHIFT:
        raise RuntimeError("Invalid left shift, max left shift is {}".format(MAX_SHIFT))
    return a << b
safe version of lshift