def text_to_bytes_and_warn(label, obj):
 if isinstance(obj, text_type):
  warn(_TEXT_WARNING.format(label), category=DeprecationWarning, stacklevel=3)
  return obj.encode('utf-8')
 return obj

def text_to_bytes_and_warn ( label , obj ) : if isinstance ( obj , text_type ) : warn ( _TEXT_WARNING . format ( label ) , category = DeprecationWarning , stacklevel = 3 ) return obj . encode ( 'utf-8' ) return obj
if obj is text .