human
Complete the below
def inf_to_nan(func):

    ''''Decorate function to return nan if it returns inf'
    '''
 ... What is a the Python program you requested?
assistant
#Here is the Python program you requested.
    def wrap(*a, **kw):
        v = func(*a, **kw)
        if (not np.isfinite(v)):
            return np.nan
        return v
    return wrap