def _user_to_uid(user):
 if ((user is None) or (user == '')):
  return ''
 try:
  (sid, domain, account_type) = win32security.LookupAccountName(None, user)
 except pywinerror as exc:
  if (exc.winerror == 1332):
   return ''
  else:
   raise
 return win32security.ConvertSidToStringSid(sid)

def _user_to_uid ( user ) : if ( ( user is None ) or ( user == '' ) ) : return '' try : ( sid , domain , account_type ) = win32security . LookupAccountName ( None , user ) except pywinerror as exc : if ( exc . winerror == 1332 ) : return '' else : raise return win32security . ConvertSidToStringSid ( sid )
convert user name to a uid .