def _join_groups(groups):
    for group in groups.values():
        for req in group.get('requires', ()):
            if req in groups:
                group['cross_depends'].append({
                    'name': TASK_END_TEMPLATE.format(req),
                    'role': _get_role(groups[req])
                })
        for req in group.get('required_for', ()):
            if req in groups:
                groups[req]['cross_depends'].append({
                    'name': TASK_END_TEMPLATE.format(group['id']),
                    'role': _get_role(group)
                })
dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/task/legacy_tasks_adapter.py/_join_groups/original