def is_prime(num):
    """Return is num is prime."""
    if num <= 1:
        return False
    if num == 2:
        return True
    if not num & 1:
        return False

    for i in range(3, int(num**0.5)+1, 2):
        if not (num % i):
            return False
    return True