Since <code>assigned_names</code> and <code>templates_required</code> are both sets then maybe <code>_get_blog_river_templates</code> should return a set. In this case  line 325 might be become something similar to <code>templates_required |= blog_river_tpls - assigned_names</code>