import shutil
from os.path import expanduser, exists
from configobj import ConfigObj
# from prompt_toolkit.contrib.pdb import set_trace


def load_config(filename, default_filename=None):
    filename = expanduser(filename)
    config = ConfigObj(filename, interpolation=False)

    if default_filename:
        config.merge(load_config(default_filename))

    return config


def write_default_config(source, destination, overwrite=False):
    destination = expanduser(destination)
    if not overwrite and exists(destination):
        return

    shutil.copyfile(source, destination)

@@ -309,21 +309,18 @@
     
-config.merge(
+default = 
 load
@@ -344,17 +344,69 @@
 ilename)
-)
+%0A        default.merge(config)%0A        return default
 %0A%0A    re

fix precendence order of default and user config