class_docstr: A map-to-arrays container, with deterministic Reservoir Sampling.
  
  Items are added with an associated key. Items may be retrieved by key, and
  a list of keys can also be retrieved. If size is not zero, then it dictates
  the maximum number of items that will be stored with each key. Once there are
  more items for a given key, they are replaced via reservoir sampling, such
  that each item has an equal probability of being included in the sample.
  
  Deterministic means that for any given seed and bucket size, the sequence of
  values that are kept for any given tag will always be the same, and that this
  is independent of any insertions on other tags. That is:
  
  >>> separate_reservoir = reservoir.Reservoir(10)
  >>> interleaved_reservoir = reservoir.Reservoir(10)
  >>> for i in range(100):
  >>>   separate_reservoir.AddItem('key1', i)
  >>> for i in range(100):
  >>>   separate_reservoir.AddItem('key2', i)
  >>> for i in range(100):
  >>>   interleaved_reservoir.AddItem('key1', i)
  >>>   interleaved_reservoir.AddItem('key2', i)
  
  separate_reservoir and interleaved_reservoir will be in identical states.
  
  See: https://en.wikipedia.org/wiki/Reservoir_sampling
  
  Adding items has amortized O(1) runtime.
  
  Fields:
    always_keep_last: Whether the latest seen sample is always at the
      end of the reservoir. Defaults to True.
    size: An integer of the maximum number of samples.
docstr: Return items associated with given key.
  
  Args:
    key: The key for which we are finding associated items.
  
  Raises:
    KeyError: If the key is not found in the reservoir.
  
  Returns:
    [list, of, items] associated with that key.
docstr_tok: ["Return","items","associated","with","given","key",".","Args",":","key",":","The","key","for","which","we","are","finding","associated","items",".","Raises",":","KeyError",":","If","the","key","is","not","found","in","the","reservoir",".","Returns",":","[","list",",","of",",","items","]","associated","with","that","key","."]
code: def Items(self, key):
      """Return items associated with given key.
  
      Args:
        key: The key for which we are finding associated items.
  
      Raises:
        KeyError: If the key is not found in the reservoir.
  
      Returns:
        [list, of, items] associated with that key.
      """
      with self._mutex:
          if key not in self._buckets:
              raise KeyError("Key %s was not found in Reservoir" % key)
          bucket = self._buckets[key]
      return bucket.Items()
  
file_path: tensorboard/tensorboard/backend/event_processing/reservoir.py
imports: import collections
  import random
  import threading
label_desc: Use image node_id 3 for calling the Reservoir obj's underlying member method code with example usage: obj.Items(key) and returns: bucket