def to_basestring(value):
 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')

def to_basestring ( value ) : 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' )
converts a string argument to a subclass of basestring .