def win_encode(s):
 if isinstance(s, unicode):
  return s.encode(locale.getpreferredencoding(False))
 elif isinstance(s, bytes):
  return s
 elif (s is not None):
  raise TypeError(('Expected bytes or text, but got %r' % (s,)))

def win_encode ( s ) : if isinstance ( s , unicode ) : return s . encode ( locale . getpreferredencoding ( False ) ) elif isinstance ( s , bytes ) : return s elif ( s is not None ) : raise TypeError ( ( 'Expected bytes or text, but got %r' % ( s , ) ) )
encode unicodes for process arguments on windows .