Collision resolution formula from python's dictobject.c