@classmethod
def fromdict(cls, mapping):
    """
        Create a new `udict` from the given `mapping` dict.
        The resulting `udict` will be equivalent to the input
        `mapping` dict but with all dict instances (recursively)
        converted to an `udict` instance.  If you don't want
        this behavior (i.e., you want sub-dicts to remain plain dicts),
        use `udict(mapping)` instead.
        """
    ud = cls()
    for k in mapping:
        v = dict.__getitem__(mapping, k)
        if isinstance(v, dict):
            v = cls.fromdict(v)
        dict.__setitem__(ud, k, v)
    return ud
