from math import log


def is_power_of_two(x):
    """
    Returns true if x is a power of two, false otherwise.
    """

    if x <= 0:
        return False
    log2 = int(log(x, 2))
    return x == 2 ** log2