When we looked at Blog objects in Chapter 11, Storing and Retrieving Objects via Shelve, we defined a by_tag() method to emit useful dictionary representations of the posts organized by the relevant tag strings. The method had a definition with a type hint that was Dict[str, List[Dict[str, Any]]]. Because it provided information useful for creating tags with links, the by_tag() method was a helpful part of rendering a Blog instance as RST or HTML. Additionally, the entries property returns the complete collection of Post instances attached to the Blog.
Ideally, the application model class definitions such as Blog and Post are utterly divorced from the access layer objects, which persist them in the external ...