from operator import neg


def ph_type(func):
    """
    Returns phase type
    
    0 -> positive
    1 -> negative
    2 -> gradient
    """
    return 0 if  func is None else 1 if func == neg else 2