def findpower2(num):
    """find the nearest number that is the power of 2"""
    if num & (num-1) == 0:
        return num

    bin_num = bin(num)
    origin_bin_num = str(bin_num)[2:]
    near_power2 = pow(10, len(origin_bin_num))
    near_power2 = "0b" + str(near_power2)
    near_power2 = int(near_power2, base=2)

    return near_power2