Matching genres in party mode?

I’m asking if there is an add-on or option somewhere that does this:

When playing music through Party Mode, I’d like it to match the genre that is currently playing for a set number of songs. Then I’d like it to continue after that set is done by picking another random song/genre (like normal) and matching a set to this new genre. It would continue on and on like this. Essentially I’d like it to avoid completely random mashups (e.g. Children of Bodom > Mozart > Deadmau5) and have a bit more natural flow when listening to music.

Here’s an example:

Start Party Mode. First selection is “Led Zeppelin”. Party mode randomly picks 3 songs that match the genre “Rock”. When that set ends, Party Mode is free to pick from the complete library, so “Tech N9ne” comes up. Then it proceeds to pick from the pool of “Hip-Hop” for the next 3 songs. And so on.

Thanks for the help. I don’t know if this exists or I should just get off my ass and learn some Python.