def _recurse_binary_exponentiation(num, power):
    """
    Recursively calculate num**power quickly (via binary exponentiation). 
    
    Helper function. We did parameter checks before so that we don't have to 
    do them inside every recursive call.
    """
    if power == 1:
        return num
    num_squared = num * num
    if power % 2 == 0:
        # power was even
        return _recurse_binary_exponentiation(num_squared, power // 2)
    else:
        # power was odd
        return num * _recurse_binary_exponentiation(num_squared, power // 2)