def is_a_power_of_2(x: int) -> bool:
    """Check if an integer is a power of two.

    Args:
        x (int): Number to check

    Returns:
        bool: True if the number is a power of two
    """
    # https://stackoverflow.com/questions/57025836/how-to-check-if-a-given-number-is-a-power-of-two

    return x > 0 and (x & (x - 1)) == 0