How to implement __getitem__, __setitem__, and __delitem__ in Python