Time Based Key Value Store Leetcode Python