@staticmethod
def _get_defaults_dict(key: str, value) ->dict:
    """
        Since we're allowing nested config stuff now, not storing the
        _defaults as a flat dict sounds like a good idea. May turn out
        to be an awful one but we'll see.
        """
    ret = {}
    partial = ret
    splitted = key.split('__')
    for i, k in enumerate(splitted, start=1):
        if not k.isidentifier():
            raise RuntimeError("'{}' is an invalid config key.".format(k))
        if i == len(splitted):
            partial[k] = value
        else:
            partial[k] = {}
            partial = partial[k]
    return ret
