def get_name(principal):
 sid_obj = principal
 try:
  sid_obj = win32security.LookupAccountName(None, principal)[0]
 except (pywintypes.error, TypeError):
  pass
 try:
  sid_obj = win32security.ConvertStringSidToSid(principal)
 except (pywintypes.error, TypeError):
  pass
 try:
  return win32security.LookupAccountSid(None, sid_obj)[0]
 except TypeError:
  raise CommandExecutionError('Could not find User for {0}'.format(principal))

def get_name ( principal ) : sid_obj = principal try : sid_obj = win32security . LookupAccountName ( None , principal ) [ 0 ] except ( pywintypes . error , TypeError ) : pass try : sid_obj = win32security . ConvertStringSidToSid ( principal ) except ( pywintypes . error , TypeError ) : pass try : return win32security . LookupAccountSid ( None , sid_obj ) [ 0 ] except TypeError : raise CommandExecutionError ( 'Could not find User for {0}' . format ( principal ) )
generates a pretty name from a database table name .