cms.utils.plugins: builtins and std library refactors

requires_reload(): any()
downcast_plugins(): list comp
assign_plugins(): simplified call of build_plugin_tree

build_plugin_tree():
Reworked to do a groupby query and documentation added. Now also accepts an
iterable. Python3 requires partitioning roots and nonroots to sort on the
parent_id attribute. Sorting the nonroots allows grouping and guarantees the
children tuples are sorted.