def upgrade_release_roles_51_to_60(roles_meta, add_meta=None):
    """Convert role_metadata.depends values into roles_metadata.restrictions"""
    add_meta = add_meta or {}
    for role_name, role in six.iteritems(roles_meta):
        for depend in role.get('depends', []):
            cond = depend.get('condition')
            new_restriction = {
                'condition': remove_question_operator(negate_condition(cond))
            }
            if 'warning' in depend:
                new_restriction['message'] = depend['warning']

            role.setdefault('restrictions', [])
            role['restrictions'].append(new_restriction)

        if 'depends' in role:
            del role['depends']

        if role_name in add_meta:
            role.update(add_meta[role_name])
    return roles_meta
dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/utils/migration.py/upgrade_release_roles_51_to_60/original