fixes #3999 - refactor DRY implementation of "nested label" for hostgroup and loc/org