docs: 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 value is None:
          return 'None'
      if isinstance(value, _BASESTRING_TYPES):
          return value
      elif isinstance(value, unicode_type):
          return value.decode("utf-8")
      else:
          return str(value)