import math


def safe_is_nan(x):
    """Is the value NaN (not a number).

    Returns True for np.nan and nan python float. Returns False for anything
    else, including None and non-numeric types.

    Called safe because it won't raise a TypeError for non-numerics.


    Args:
        x: Object to check for NaN.

    Returns:
        Boolean whether the object is NaN.
    """
    try:
        return math.isnan(x)
    except TypeError:
        return False