code: def coerce_text(v):
      if not isinstance(v, basestring_):
          if sys.version_info[0] < 3:
              attr = "__unicode__"
          else:
              attr = "__str__"
          if hasattr(v, attr):
              return unicode(v)
          else:
              return bytes(v)
      return v
  
imports: from __future__ import absolute_import, division, print_function
  import sys
label_desc: Use image node_id 2 for calling a global function with example usage: coerce_text(v) and returns: v, unicode, bytes