code: def instance_to_unicode(instance):
      if PY3:
          if hasattr(instance, "__str__"):
              return unicode(instance)
          elif hasattr(instance, "__bytes__"):
              return bytes(instance).decode("utf-8")
      else:
          if hasattr(instance, "__unicode__"):
              return unicode(instance)
          elif hasattr(instance, "__str__"):
              return bytes(instance).decode("utf-8")
  
      return to_unicode(repr(instance))
  
file_path: sumy/sumy/_compat.py
imports: from __future__ import absolute_import
  from __future__ import division, print_function, unicode_literals
  from sys import version_info
label_desc: Use image node_id 6 for calling a global function with example usage: instance_to_unicode(instance) and returns: to_unicode, unicode, unicode, bytes, bytes