# Buggy code
def _get_raw_servers(self):
    # pylint: disable=cell-var-from-loop
    """Get a map of unparsed all server blocks"""
    servers = {}
    for filename in self.parsed:
        tree = self.parsed[filename]
        servers[filename] = []
        srv = servers[filename]  # workaround undefined loop var in lambdas

        # Find all the server blocks
        _do_for_subarray(
            tree, lambda x: x[0] == ["server"], lambda x, y: srv.append((x[1], y))
        )

        # Find 'include' statements in server blocks and append their trees
        for i, (server, path) in enumerate(servers[filename]):
            new_server = self._get_included_directives(server)
            servers[filename][i] = (new_server, path)
    return servers


# Traceback (IndexError)
2016-12-11 13:18:22,545:DEBUG:certbot.main:Root logging level set at 20
2016-12-11 13:18:22,549:INFO:certbot.main:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2016-12-11 13:18:22,552:DEBUG:certbot.main:certbot version: 0.10.0.dev0
2016-12-11 13:18:22,552:DEBUG:certbot.main:Arguments: ['--nginx']
2016-12-11 13:18:22,555:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#script,PluginEntryPoint#standalone,PluginEntryPoint#manual,PluginEntryPoint#webroot,PluginEntryPoint#nginx,PluginEntryPoint#null)
2016-12-11 13:18:22,557:DEBUG:certbot.plugins.selection:Requested authenticator nginx and installer nginx
2016-12-11 13:18:25,558:DEBUG:certbot.plugins.selection:Single candidate plugin: * nginx
Description: Nginx Web Server plugin - Alpha
Interfaces: IAuthenticator, IInstaller, IPlugin
Entry point: nginx = certbot_nginx.configurator:NginxConfigurator
Initialized: <certbot_nginx.configurator.NginxConfigurator object at 0xb6931d8c>
Prep: True
2016-12-11 13:18:25,563:DEBUG:certbot.plugins.selection:Selected authenticator <certbot_nginx.configurator.NginxConfigurator object at 0xb6931d8c> and installer <certbot_nginx.configurator.NginxConfigurator object at 0xb6931d8c>
2016-12-11 13:18:25,658:DEBUG:certbot.main:Exiting abnormally:
Traceback (most recent call last):
File "/usr/bin/certbot", line 11, in <module>
load_entry_point('certbot==0.10.0.dev0', 'console_scripts', 'certbot')()
File "/usr/lib/python2.7/site-packages/certbot/main.py", line 818, in main
return config.func(config, plugins)
File "/usr/lib/python2.7/site-packages/certbot/main.py", line 550, in run
domains, certname = _find_domains_or_certname(config, installer)
File "/usr/lib/python2.7/site-packages/certbot/main.py", line 288, in _find_domains_or_certname
domains = display_ops.choose_names(installer)
File "/usr/lib/python2.7/site-packages/certbot/display/ops.py", line 103, in choose_names
domains = list(installer.get_all_names())
File "/usr/lib/python2.7/site-packages/certbot_nginx/configurator.py", line 391, in get_all_names
for vhost in self.parser.get_vhosts():
File "/usr/lib/python2.7/site-packages/certbot_nginx/parser.py", line 134, in get_vhosts
servers = self._get_raw_servers()
File "/usr/lib/python2.7/site-packages/certbot_nginx/parser.py", line 114, in _get_raw_servers
lambda x, y: srv.append((x[1], y)))
File "/usr/lib/python2.7/site-packages/certbot_nginx/parser.py", line 364, in _do_for_subarray
_do_for_subarray(item, condition, func, path + [index])
File "/usr/lib/python2.7/site-packages/certbot_nginx/parser.py", line 364, in _do_for_subarray
_do_for_subarray(item, condition, func, path + [index])
File "/usr/lib/python2.7/site-packages/certbot_nginx/parser.py", line 360, in _do_for_subarray
if condition(entry):
File "/usr/lib/python2.7/site-packages/certbot_nginx/parser.py", line 113, in <lambda>
_do_for_subarray(tree, lambda x: x[0] == ['server'],
IndexError: list index out of range

# Fixed code
def _get_raw_servers(self):
    # pylint: disable=cell-var-from-loop
    """Get a map of unparsed all server blocks"""
    servers = {}
    for filename in self.parsed:
        tree = self.parsed[filename]
        servers[filename] = []
        srv = servers[filename]  # workaround undefined loop var in lambdas

        # Find all the server blocks
        _do_for_subarray(
            tree,
            lambda x: len(x) >= 2 and x[0] == ["server"],
            lambda x, y: srv.append((x[1], y)),
        )

        # Find 'include' statements in server blocks and append their trees
        for i, (server, path) in enumerate(servers[filename]):
            new_server = self._get_included_directives(server)
            servers[filename][i] = (new_server, path)
    return servers