def gcd(a, b):
    """greatest common divisor
    
    Calculates the greatest common divisor with
    Euclidean algorithm.
    example:
        
        val = gcd(33, 6)
        print(val) ## 3
    
    Args:
        a: an int representing the first argument
        b: an int representing the second argument
    
    Returns:
        an int representing the greatest common divisor

    """
    if (a < b):
        a, b = b, a
    temp = -1
    while a % b != 0:
        temp = a
        a = b
        b = temp % b
    return b