def _powl(base, exp):
    """
    Algorithm taken from https://stackoverflow.com/questions/2198138/calculating-powers-e-g-211-quickly
    """
    if exp == 0:
        return 1
    elif exp == 1:
        return base
    elif (exp & 1) != 0:
        return base * _powl(base * base, exp // 2)
    else:
        return _powl(base * base, exp // 2)