An example is worth a thousand words. Here's some pointers to various solutions and examples available today.

Automation/Code Exchange

DevNet Automation Exchange has lots of useful examples related to network automation in general.

Search for pyATS under Test & Validation section.

Examples:

GitHub Repos