def _fix_config_yml(filepath, distribution):
    """Comment out 'additional_patterns', and replace the distribution of the
    local machine with `distribution`.
    """
    with open(filepath) as fp:
        config = fp.readlines()
    for ii, line in enumerate(config):
        if line.startswith('additional_patterns'):
            config[ii] = '# ' + line
        if 'distribution:' in line:
            pre = line.split(':')[0]
            config[ii] = '{}: {}\n'.format(pre, distribution)
    with open(filepath, 'w') as fp:
        for line in config:
            fp.write(line)
