def sort_posts(post_db: dict, sort_key: str) -> list:
    """Return a sorted list of posts, given a dict of data for all posts.

    Args:
        post_db: data for all posts
        sort_key: key by which the posts should be sorted; can be either 'date' or 'post_title'

    Returns:
        list of sorted posts
    """
    valid_keys = ['date', 'post_title']
    assert sort_key in valid_keys, 'Cannot sort by that key. '
    reverse = True if (sort_key == 'date') else False

    post_list = post_db.keys()
    sorted_posts = sorted(post_list, key=lambda post: str(post_db[post][sort_key]), reverse=reverse)

    return sorted_posts