def cfg_from_list(cfg_list):
    'Set config keys via list (e.g., from command line).'
    from ast import literal_eval
    assert ((len(cfg_list) % 2) == 0)
    for (k, v) in zip(cfg_list[0::2], cfg_list[1::2]):
        key_list = k.split('.')
        d = __C
        for subkey in key_list[:(- 1)]:
            assert (subkey in d)
            d = d[subkey]
        subkey = key_list[(- 1)]
        assert (subkey in d)
        try:
            value = literal_eval(v)
        except:
            value = v
        assert (type(value) == type(d[subkey])), 'type {} does not match original type {}'.format(type(value), type(d[subkey]))
        d[subkey] = value
Set config keys via list (e.g., from command line).
def cfg_from_list(cfg_list):
    
    from ast import literal_eval
    assert ((len(cfg_list) % 2) == 0)
    for (k, v) in zip(cfg_list[0::2], cfg_list[1::2]):
        key_list = k.split('.')
        d = __C
        for subkey in key_list[:(- 1)]:
            assert (subkey in d)
            d = d[subkey]
        subkey = key_list[(- 1)]
        assert (subkey in d)
        try:
            value = literal_eval(v)
        except:
            value = v
        assert (type(value) == type(d[subkey])), 'type {} does not match original type {}'.format(type(value), type(d[subkey]))
        d[subkey] = value