def convert_to(obj, ac_ordered=False, ac_dict=None, **options):
    """
    Convert a mapping objects to a dict or object of 'to_type' recursively.
    Borrowed basic idea and implementation from bunch.unbunchify. (bunch is
    distributed under MIT license same as this.)

    :param obj: A mapping objects or other primitive object
    :param ac_ordered: Use OrderedDict instead of dict to keep order of items
    :param ac_dict: Callable to convert 'obj' to mapping object
    :param options: Optional keyword arguments.

    :return: A dict or OrderedDict or object of 'cls'

    >>> OD = anyconfig.compat.OrderedDict
    >>> convert_to(OD((('a', 1) ,)), cls=dict)
    {'a': 1}
    >>> convert_to(OD((('a', OD((('b', OD((('c', 1), ))), ))), )), cls=dict)
    {'a': {'b': {'c': 1}}}
    """
    options.update(ac_ordered=ac_ordered, ac_dict=ac_dict)
    if anyconfig.utils.is_dict_like(obj):
        return _make_recur(obj, convert_to, **options)
    if anyconfig.utils.is_list_like(obj):
        return _make_iter(obj, convert_to, **options)

    return obj
Convert a mapping objects to a dict or object of 'to_type' recursively.
    Borrowed basic idea and implementation from bunch.unbunchify. (bunch is
    distributed under MIT license same as this.)

    :param obj: A mapping objects or other primitive object
    :param ac_ordered: Use OrderedDict instead of dict to keep order of items
    :param ac_dict: Callable to convert 'obj' to mapping object
    :param options: Optional keyword arguments.

    :return: A dict or OrderedDict or object of 'cls'

    >>> OD = anyconfig.compat.OrderedDict
    >>> convert_to(OD((('a', 1) ,)), cls=dict)
    {'a': 1}
    >>> convert_to(OD((('a', OD((('b', OD((('c', 1), ))), ))), )), cls=dict)
    {'a': {'b': {'c': 1}}}