import math


def is_finite(x):
    """
    Returns true if the argument is a float or int and it is not infinite or NaN
    """
    try:
        return not math.isinf(x)
    except TypeError:
        return False