'Push a group as a child of another group.'

def push_group(self, my_dict, key, element):

    parent_group = my_dict.setdefault(key, {})
    if (not isinstance(parent_group, dict)):
        parent_group = my_dict[key] = {'hosts': parent_group}
    child_groups = parent_group.setdefault('children', [])
    if (element not in child_groups):
        child_groups.append(element)
