def is_cgi(self):
        """Test if url in a cgi directory"""
        for path in self.cgi_directories:
            if self.path.startswith(path):
                rest = self.path[len(path):]
                if not rest or rest.startswith('/'):
                    return True
        return False
Test if url in a cgi directory
recipes/Python/511454_asynchronous_HTTP_server_CGI/recipe-511454.py