def getUserSid(username):
 domain = win32api.GetComputerName()
 if (username.find(u'\\') != (-1)):
  domain = username.split(u'\\')[0]
  username = username.split(u'\\')[(-1)]
 domain = domain.upper()
 return win32security.ConvertSidToStringSid(win32security.LookupAccountName(None, ((domain + u'\\') + username))[0])

def getUserSid ( username ) : domain = win32api . GetComputerName ( ) if ( username . find ( u'\\' ) != ( - 1 ) ) : domain = username . split ( u'\\' ) [ 0 ] username = username . split ( u'\\' ) [ ( - 1 ) ] domain = domain . upper ( ) return win32security . ConvertSidToStringSid ( win32security . LookupAccountName ( None , ( ( domain + u'\\' ) + username ) ) [ 0 ] )
get the security id for the user .