def next_power_of_two(num):
    """Returns the next power of two >= num.

    Args:
        num: A positive integer.

    Returns:
        The next power of two >= num.
    """
    val = 1
    while val < num:
        val *= 2
    return val