huge rewrite, split to base and yandex-specific parts

it's helper that sorts using the same key before grouping https://github.com/yandex-sysmon/dominator/blob/master/dominator/utils/__init__.py#L99-L100 .
`groupbysorted` ?