def ensure_int_float(value):
    """Return value if type(value) is int or float.

    Otherwise raises TypeError.

    Parameters
    **********
        value (any Python obj)
    """
    if type(value) not in (int, float):

        msg = "Value must be {!r} or {!r}.".format(int, float)

        raise TypeError(msg)

    return value
Return value if type(value) is int or float.

    Otherwise raises TypeError.

    Parameters
    **********
        value (any Python obj)
    
nodezator/widget/intfloatentry/main.py