@classmethod
def from_flat(cls, data, dict_type='ndict'):
    """Initialize from a dict keyed by tuples
        Each tuple-element is taken as a key for each level in the NestedDict

        Parameters
        ----------
        data: dict, list
            Dictionary keyed by tuples
        dict_type: ['ndict', 'dict', 'odict']
            Dict-type in string format, for initializing dicts at depth if they
            don't exist yet

        Returns
        -------
        NestedDict
        """
    if isinstance(data, dict):
        iterdata = data.items()
    elif isinstance(data, list):
        iterdata = data
    else:
        raise TypeError('from_flat requires a dict or list, not {}'.format(
            type(data)))
    new_dict = cls()
    for key_list, val in iterdata:
        new_dict.nested_set(key_list, val, dict_type=dict_type)
    return new_dict
