code: def exception_to_nan(func):
      """Decorate function to return nan if it raises an exception"""
  
      def wrap(*a, **kw):
          try:
              return func(*a, **kw)
          except Exception:
              return np.nan
  
      return wrap
  
imports: import os
  import sys
  import time
  import numpy
  from numpy.testing import assert_
  import pytest
  from scipy.special._testutils import assert_func_equal
label_desc: Use image node_id 8 for calling a global function with example usage: exception_to_nan(func) and returns: wrap, func, np