def get_security_attributes_for_user(user=None):
if user is None:<EOL><INDENT>user = get_current_user()<EOL><DEDENT>assert isinstance(user, TOKEN_USER), "<STR_LIT>"<EOL>SD = SECURITY_DESCRIPTOR()<EOL>SA = SECURITY_ATTRIBUTES()<EOL>SA.descriptor = SD<EOL>SA.bInheritHandle = <NUM_LIT:1><EOL>ctypes.windll.advapi32.InitializeSecurityDescriptor(<EOL>ctypes.byref(SD), SECURITY_DESCRIPTOR.REVISION<EOL>)<EOL>ctypes.windll.advapi32.SetSecurityDescriptorOwner(<EOL>ctypes.byref(SD), user.SID, <NUM_LIT:0><EOL>)<EOL>return SA<EOL>
Return a SECURITY_ATTRIBUTES structure with the SID set to the
specified user (uses current user if none is specified).