code: def to_bytes(object):
      if isinstance(object, bytes):
          return object
      elif isinstance(object, unicode):
          return object.encode("utf-8")
      else:
          # try encode instance to bytes
          return instance_to_bytes(object)
  
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 3 for calling a global function with example usage: to_bytes(object) and returns: object, object, instance_to_bytes