<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def calculate_bucket_level(k, b):
 """ Calculate the level in which a 0-based bucket lives inside of a k-ary heap. """

    assert k >= 2
    if k == 2:
        return log2floor(b+1)
    v = (k - 1) * (b + 1) + 1
    h = 0
    while k**(h+1) < v:
        h += 1
    return h