code: def _find_matching_instance(cache_key):
    
    infos = get_all()
    candidates = [info for info in infos if info.cache_key == cache_key]
    for candidate in sorted(candidates, key=lambda x: x.port):
      # TODO(@wchargin): Check here that the provided port is still live.
      return candidate
    return None
docs: Find a running TensorBoard instance compatible with the cache key.
  
    Returns:
      A `TensorBoardInfo` object, or `None` if none matches the cache key.