def get_index(index_management: IndexManagement, index_name: str, force_refresh=False) -> MarqoIndex:
    """
    Get an index.

    Args:
        index_management: IndexManagement object to load the index if not found in cache
        index_name (str): Name of the index to retrieve.
        force_refresh: Get index from Vespa even if already in cache. If False, Vespa is called only if index is not
        found in cache.

    Returns:
        The latest index if the index is not found in cache or force_refresh flag is True. Otherwise, the cached index

    Raises:
        IndexNotFoundError: If index is not found in cache.
    """
    # Make sure refresh thread is running
    _check_refresh_thread(index_management)

    if force_refresh or index_name not in index_info_cache:
        _refresh_index(index_management, index_name)

    if index_name in index_info_cache:
        return index_info_cache[index_name]

    # TODO: raise core_exceptions.IndexNotFoundError instead (fix associated tests)
    raise exceptions.IndexNotFoundError(f"Index {index_name} not found")

    Get an index.

    Args:
        index_management: IndexManagement object to load the index if not found in cache
        index_name (str): Name of the index to retrieve.
        force_refresh: Get index from Vespa even if already in cache. If False, Vespa is called only if index is not
        found in cache.

    Returns:
        The latest index if the index is not found in cache or force_refresh flag is True. Otherwise, the cached index

    Raises:
        IndexNotFoundError: If index is not found in cache.
    
src/marqo/tensor_search/index_meta_cache.py