I was having some issues connecting an authenticated session with Windows Server 2008 x64, commenting out #dce.set_auth_level(ntlm.NTLM_AUTH_PKT_INTEGRITY) fixed that issue.
Also when trying to connect to a NULL Session it was failing also. Changing the hsamrconnect to hsamrconnect2
I was having some issues connecting an authenticated session with Windows Server 2008 x64, commenting out #dce.set_auth_level(ntlm.NTLM_AUTH_PKT_INTEGRITY) fixed that issue.
Also when trying to connect to a NULL Session it was failing also. Changing the hsamrconnect to hsamrconnect2
resp = samr.hSamrConnect2(dce) fixed this also.