from typing import Mapping
from typing import Sequence


def convert_to_base_types(o):
    """
    Convert the given container into a standard dict or list (recursively).
    This is useful if you need to pass your config to a function that is
    hard-coded to check for dicts or lists rather than Mapping or Sequence.
    """
    if type(o) != dict and isinstance(o, Mapping):
        return { k: convert_to_base_types(v) for k,v in o.items() }
    if type(o) not in (list, str, bytes) and isinstance(o, Sequence):
        return [convert_to_base_types(i) for i in o]
    return o