code: def to_basestring(value):
      """Converts a string argument to a subclass of basestring.
  
      In python2, byte and unicode strings are mostly interchangeable,
      so functions that deal with a user-supplied argument in combination
      with ascii string constants can use either and should return the type
      the user supplied.  In python3, the two types are not interchangeable,
      so this method is needed to convert byte strings to unicode.
      """
      if isinstance(value, _BASESTRING_TYPES):
          return value
      if not isinstance(value, bytes):
          raise TypeError(
              "Expected bytes, unicode, or None; got %r" % type(value)
          )
      return value.decode("utf-8")
  
file_path: catboost/contrib/python/tornado/tornado-4/tornado/escape.py
imports: from __future__ import absolute_import, division, print_function
  import json
  import re
  from tornado.util import PY3, unicode_type, basestring_type
label_desc: Use image node_id 9 for calling a global function with example usage: to_basestring(value) and returns: value, value