message: Attach registered py_func function to the original function in eager.
  This will allow users to extend the lifetime of registered py_func function by
  keeping the original function.
diff: @@ -19,7 +19,6 @@ from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  -import inspect
  import threading
  # Used by py_util.cc to get tracebacks.
  @@ -42,6 +41,7 @@ from tensorflow.python.util import compat
  from tensorflow.python.util import deprecation
  from tensorflow.python.util import lazy_loader
  from tensorflow.python.util import nest
  +from tensorflow.python.util import tf_inspect
  from tensorflow.python.util.tf_export import tf_export
  autograph = lazy_loader.LazyLoader(
  @@ -285,6 +285,15 @@ def _internal_py_func(func,
  original_func = func
  func = autograph.do_not_convert(func)
  + is_list_or_tuple = False
  + if isinstance(Tout, (list, tuple)):
  + is_list_or_tuple = True
  + else:
  + Tout = [Tout]
  +
  + if eager:
  + func = EagerFunc(func, Tout, is_grad_func)
  +
  # Tying the registered function's lifetime with the current default graph is
  # not reliable. For example, Estimator-based binaries may switch graphs in
  # between model training end evaluation, via saved_model. Those binaries work
  @@ -293,21 +302,12 @@ def _internal_py_func(func,
  # To avoid breaking those cases, we attach the wrapper to the original
  # function so that their lifetime is connected.
  # TODO(b/144286616): Remove this.
  - if inspect.isfunction(original_func):
  + if tf_inspect.isfunction(original_func):
  # Note: this check is needed because original_func may be a descriptor
  # (https://docs.python.org/3/howto/descriptor.html)
  # and we can't attach attributes to those.
  original_func.ag_dnc_wrapper__ = func
  - is_list_or_tuple = False
  - if isinstance(Tout, (list, tuple)):
  - is_list_or_tuple = True
  - else:
  - Tout = [Tout]
  -
  - if eager:
  - func = EagerFunc(func, Tout, is_grad_func)
  -
  token = _py_funcs.insert(func)
  # We tie the registered function's lifetime with the current default graph,
  # i.e., when the current graph is destroyed, we remove its py funcs.
  