code: def read_config(args, parser):
      
      try:
          from configparser import ConfigParser as SafeConfigParser
          from configparser import Error
      except ImportError:
          from ConfigParser import SafeConfigParser
          from ConfigParser import Error
  
      config = SafeConfigParser()
  
      try:
          config.read(args.global_config)
  
          if not args.ignore_local_config:
              parent = tail = args.files and os.path.abspath(
                  os.path.commonprefix(args.files))
              while tail:
                  if config.read([os.path.join(parent, fn)
                                  for fn in PROJECT_CONFIG]):
                      break
                  (parent, tail) = os.path.split(parent)
  
          defaults = {}
          option_list = {o.dest: o.type or type(o.default)
                         for o in parser._actions}
  
          for section in ['pep8', 'pycodestyle', 'flake8']:
              if not config.has_section(section):
                  continue
              for (k, _) in config.items(section):
                  norm_opt = k.lstrip('-').replace('-', '_')
                  if not option_list.get(norm_opt):
                      continue
                  opt_type = option_list[norm_opt]
                  if opt_type is int:
                      value = config.getint(section, k)
                  elif opt_type is bool:
                      value = config.getboolean(section, k)
                  else:
                      value = config.get(section, k)
                  if args.verbose:
                      print("enable config: section={}, key={}, value={}".format(
                          section, k, value))
                  defaults[norm_opt] = value
  
          parser.set_defaults(**defaults)
      except Error:
          # Ignore for now.
          pass
  
      return parser
docs: Read both user configuration and local configuration.