code: def real_if_close(a, tol=100):
      a = ivy.array(a, dtype=a.dtype)
      dtype_ = a.dtype
  
      if not ivy.is_complex_dtype(dtype_):
          return a
  
      if tol > 1:
          f = ivy.finfo(dtype_)
          tol = f.eps * tol
  
      if ivy.all(ivy.abs(ivy.imag(a)) < tol):
          a = ivy.real(a)
  
      return a
  
file_path: ivy/ivy/functional/frontends/numpy/mathematical_functions/miscellaneous.py
imports: import ivy
  from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back, handle_numpy_casting, handle_numpy_dtype, from_zero_dim_arrays_to_scalar, handle_numpy_out
  from ivy.func_wrapper import with_supported_dtypes
label_desc: Use image node_id 16 for calling a global function with example usage: real_if_close(a, tol) and returns: a, a