code: def safe_repr(value):
      """Hopefully pretty robust repr equivalent."""
      # this is pretty horrible but should always return *something*
      try:
          return pydoc.text.repr(value)
      except KeyboardInterrupt:
          raise
      except:
          try:
              return repr(value)
          except KeyboardInterrupt:
              raise
          except:
              try:
                  # all still in an except block so we catch
                  # getattr raising
                  name = getattr(value, "__name__", None)
                  if name:
                      # ick, recursion
                      return safe_repr(name)
                  klass = getattr(value, "__class__", None)
                  if klass:
                      return "%s instance" % safe_repr(klass)
              except KeyboardInterrupt:
                  raise
              except:
                  return "UNRECOVERABLE REPR FAILURE"
  
file_path: mlens/mlens/externals/joblib/format_stack.py
imports: import inspect
  import keyword
  import linecache
  import os
  import pydoc
  import sys
  import time
  import tokenize
  import traceback
label_desc: Use image node_id 1 for calling a global function with example usage: safe_repr(value) and returns: pydoc, repr, safe_repr, unknown, str