code: def find_file(config_file=None, default_directories=None, default_bases=None):
      '''Search for a config file in a list of files.'''
  
      if config_file:
          if path.exists(path.expanduser(config_file)):
              return config_file
          else:
              raise FileNotFoundError('Config file not found: {}'.format(config_file))
  
      dirs = default_directories or CONFIG_DIRS
      dirs = [getcwd()] + dirs
  
      bases = default_bases or CONFIG_BASES
  
      for directory, base in product(dirs, bases):
          filepath = path.expanduser(path.join(directory, base))
          if path.exists(filepath):
              return filepath
  
      raise FileNotFoundError('Config file not found in {}'.format(dirs)f find_file(config_file=None, default_directories=None, default_bases=None):
      '''Search for a config file in a list of files.'''
  
      if config_file:
          if path.exists(path.expanduser(config_file)):
              return config_file
          else:
              raise FileNotFoundError('Config file not found: {}'.format(config_file))
  
      dirs = default_directories or CONFIG_DIRS
      dirs = [getcwd()] + dirs
  
      bases = default_bases or CONFIG_BASES
  
      for directory, base in product(dirs, bases):
          filepath = path.expanduser(path.join(directory, base))
          if path.exists(filepath):
              return filepath
  
      raise FileNotFoundError('Config file not found in {}'.format(dirs))
docs: Search for a config file in a list of files.