Could replace the function body with just:

    exercises = topicdata.NODE_CACHE["Exercise"].values()
    return [exercise["paths"][0] for exercise in exercises if len(exercise.get("paths", [])) > 0]