code: def load_args(args):
      
      config = kaptan.Kaptan(handler='yaml')
      conf_parent = os.path.expanduser('~')
      conf_app = '.clancy'
      conf_filename = 'config.yaml'
  
      conf_dir = os.path.join(conf_parent, conf_app)
      for loc in [os.curdir, conf_dir]:
          configpath = os.path.join(loc, conf_filename)
          try:
              if os.path.isfile(configpath):
                  config.import_config(configpath)
                  break
          except (ValueError, ParserError, ScannerError):
              warn("Ignoring invalid valid yaml file {}".format(configpath))
  
      config = (config.configuration_data
                if config.configuration_data is not None else {})
  
      # Prepend '--' to conf file keys so it matches docopt. This is the dumbest
      # thing in the world.
      for key, val in config.items():
          config['--'+key] = val
          del config[key]
  
      return validate(merge(args, config))
docs: Load a config file. Merges CLI args and validates.