def get_sid_from_name(name):
 try:
  sid = win32security.LookupAccountName(None, name)[0]
 except pywintypes.error as exc:
  raise CommandExecutionError('User {0} found: {1}'.format(name, exc[2]))
 return win32security.ConvertSidToStringSid(sid)

def get_sid_from_name ( name ) : try : sid = win32security . LookupAccountName ( None , name ) [ 0 ] except pywintypes . error as exc : raise CommandExecutionError ( 'User {0} found: {1}' . format ( name , exc [ 2 ] ) ) return win32security . ConvertSidToStringSid ( sid )
this is a tool for getting a sid from a name .