<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_navpanel_data(kwdb):
 """Get navpanel data from kwdb, and add urls necessary for hyperlinks"""

    data = kwdb.get_keyword_hierarchy()
    for library in data:
        library["url"] = flask.url_for(".doc_for_library", collection_id=library["collection_id"])
        for keyword in library["keywords"]:
            url = flask.url_for(".doc_for_library",
                                collection_id=library["collection_id"],
                                keyword=keyword["name"])
            keyword["url"] = url

    return data