<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

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,
    )