duplicate the access token

def dup_token(th):
    '''
    duplicate the access token
    '''
    # TODO: is `duplicate_token` the same?
    sec_attr = win32security.SECURITY_ATTRIBUTES()
    sec_attr.bInheritHandle = True
    return win32security.DuplicateTokenEx(
       th,
       win32security.SecurityImpersonation,
       win32con.MAXIMUM_ALLOWED,
       win32security.TokenPrimary,
       sec_attr,
    )