# Path: netjsonconfig/utils.py
# def sorted_dict(dict_):
#     return OrderedDict(sorted(dict_.items()))


import json
from collections import OrderedDict
from ....utils import sorted_dict
from .base import OpenWrtConverter
                continue
            block_list = []
            # sort each config block
            i = 1
            for block in list(value):
                # config block must be a dict
                # with a key named "config_name"
                # otherwise it's skipped with a warning
                if not isinstance(block, dict) or 'config_name' not in block:
                    json_block = json.dumps(block, indent=4)
                    print(
                        'Unrecognized config block was skipped:\n\n'
                        '{0}\n\n'.format(json_block)
                    )
                    continue
                block['.type'] = block.pop('config_name')
                block['.name'] = block.pop(
                    'config_value',
                    # default value in case the
                    # UCI name is not defined
                    '{0}_{1}'.format(block['.type'], i),
                )
                # ensure UCI name is valid
                block['.name'] = self._get_uci_name(block['.name'])
                block_list.append(sorted_dict(block))
                i += 1
            if block_list:
                extra_packages[key] = block_list
        # sort result again to avoid test failures
        # related to the random order of dict keys

# Path: netjsonconfig/utils.py
# def sorted_dict(dict_):
#     return OrderedDict(sorted(dict_.items()))


# Path: netjsonconfig/backends/openwrt/converters/default.py
import json
from collections import OrderedDict
from ....utils import sorted_dict
from .base import OpenWrtConverter

                continue
            block_list = []
            # sort each config block
            i = 1
            for block in list(value):
                # config block must be a dict
                # with a key named "config_name"
                # otherwise it's skipped with a warning
                if not isinstance(block, dict) or 'config_name' not in block:
                    json_block = json.dumps(block, indent=4)
                    print(
                        'Unrecognized config block was skipped:\n\n'
                        '{0}\n\n'.format(json_block)
                    )
                    continue
                block['.type'] = block.pop('config_name')
                block['.name'] = block.pop(
                    'config_value',
                    # default value in case the
                    # UCI name is not defined
                    '{0}_{1}'.format(block['.type'], i),
                )
                # ensure UCI name is valid
                block['.name'] = self._get_uci_name(block['.name'])
                block_list.append(sorted_dict(block))
                i += 1
            if block_list:
                extra_packages[key] = block_list
        # sort result again to avoid test failures
        # related to the random order of dict keys

        return self.sorted_dict(extra_packages)