def _salt_cloud_force_ascii(exc):
 if (not isinstance(exc, (UnicodeEncodeError, UnicodeTranslateError))):
  raise TypeError("Can't handle {0}".format(exc))
 unicode_trans = {u'\xa0': u' ', u'\u2013': u'-'}
 if (exc.object[exc.start:exc.end] in unicode_trans):
  return (unicode_trans[exc.object[exc.start:exc.end]], exc.end)
 raise exc

def _salt_cloud_force_ascii ( exc ) : if ( not isinstance ( exc , ( UnicodeEncodeError , UnicodeTranslateError ) ) ) : raise TypeError ( "Can't handle {0}" . format ( exc ) ) unicode_trans = { u'\xa0' : u' ' , u'\u2013' : u'-' } if ( exc . object [ exc . start : exc . end ] in unicode_trans ) : return ( unicode_trans [ exc . object [ exc . start : exc . end ] ] , exc . end ) raise exc
helper method to try its best to convert any unicode text into ascii without stack tracing since salt internally does not handle unicode strings this method is not supposed to be used directly .