import json


def _read_session_cache(filepath):
    """Returns the JSON contents of CACHE_DIR/SESSION_FILENAME."""
    try:
        file = open(filepath, 'r')
        result = json.load(file)
        if isinstance(result, dict):
            return result
    except:  # noqa
        # If we cannot parse the cache for any reason, treat it as if the cache is empty
        pass
    return {}