def _dictkey2list(d, prefix=''):
    """ Save all leaf-node keys in the dict into a list.
    e.g.:
    d = {
        'a': [0],
        'b': {
            'c': [1]
        },
        'd': [2]
    }
    _dictkey2list(d) = ['a', 'b.c', 'd']
    """
    if d is None:
        return []

    key_list = []
    for k in d.keys():
        if isinstance(d[k], list):
            key_list.append(prefix + k)
        elif isinstance(d[k], dict):
            prefix_next = prefix + k + '.'
            key_list = key_list + _dictkey2list(d[k], prefix_next)
        else:
            raise TypeError("Unsupport type in {}: '{}'".format(k, type(d[k])))
    return key_list