Python Dict-like data structure with thread-safe resizing