class_docstr: A dictionary-like storage that can store binary values and/or nested dictionaries until expiration
class_docstr_tok: ["A","dictionary-like","storage","that","can","store","binary","values","and\/or","nested","dictionaries","until","expiration"]
docstr: Save a (sub-key, value) into a dictionary associated with a given key.
   1) if self[key] is empty, create a new dictionary and add sub-key there
   2) if self[key] is a dictionary (DictionaryDHTValue), store {sub-key: value, expiration} to that storage
   3) if self[key] is a normal value with smaller expiration time, overwrite it with a dictionary and add sub-key
  :returns: True if new entry was stored, False it was rejected (current value is newer)
docstr_tok: ["Save","a","(","sub-key",",","value",")","into","a","dictionary","associated","with","a","given","key",".","1",")","if","self","[","key","]","is","empty",",","create","a","new","dictionary","and","add","sub-key","there","2",")","if","self","[","key","]","is","a","dictionary","(","DictionaryDHTValue",")",",","store","{","sub-key",":","value",",","expiration","}","to","that","storage","3",")","if","self","[","key","]","is","a","normal","value","with","smaller","expiration","time",",","overwrite","it","with","a","dictionary","and","add","sub-key",":","returns",":","True","if","new","entry","was","stored",",","False","it","was","rejected","(","current","value","is","newer",")"]
code: def store_subkey(
      self,
      key: DHTID,
      subkey: Subkey,
      value: BinaryDHTValue,
      expiration_time: DHTExpiration,
  ) -> bool:
      """
      Save a (sub-key, value) into a dictionary associated with a given key.
       1) if self[key] is empty, create a new dictionary and add sub-key there
       2) if self[key] is a dictionary (DictionaryDHTValue), store {sub-key: value, expiration} to that storage
       3) if self[key] is a normal value with smaller expiration time, overwrite it with a dictionary and add sub-key
      :returns: True if new entry was stored, False it was rejected (current value is newer)
      """
      previous_value, previous_expiration_time = self.get(key) or (
          b"",
          -float("inf"),
      )
      if (
          isinstance(previous_value, BinaryDHTValue)
          and expiration_time > previous_expiration_time
      ):
          new_storage = DictionaryDHTValue()
          new_storage.store(subkey, value, expiration_time)
          return super().store(
              key, new_storage, new_storage.latest_expiration_time
          )
      elif isinstance(previous_value, DictionaryDHTValue):
          if expiration_time > previous_value.latest_expiration_time:
              super().store(
                  key, previous_value, expiration_time
              )  # refresh expiration time
          return previous_value.store(subkey, value, expiration_time)
      else:
          return False
  
file_path: hivemind/hivemind/dht/storage.py
imports: from __future__ import annotations
  from typing import Optional, Union
  from hivemind.dht.routing import DHTID, BinaryDHTValue, Subkey
  from hivemind.utils.serializer import MSGPackSerializer
  from hivemind.utils.timed_storage import DHTExpiration, KeyType, TimedStorage, ValueType
label_desc: Use image node_id 2 for calling the DHTLocalStorage obj's underlying member method code with example usage: obj.store_subkey(key, subkey, value, expiration_time) and returns: super, previous_value, False