def _check_module_attrs(self, node, module, module_names):
assert isinstance(module, astroid.Module), module<EOL>while module_names:<EOL><INDENT>name = module_names.pop(<NUM_LIT:0>)<EOL>if name == "<STR_LIT>":<EOL><INDENT>module = None<EOL>break<EOL><DEDENT>try:<EOL><INDENT>module = next(module.getattr(name)[<NUM_LIT:0>].infer())<EOL>if module is astroid.Uninferable:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>except astroid.NotFoundError:<EOL><INDENT>if module.name in self._ignored_modules:<EOL><INDENT>return None<EOL><DEDENT>self.add_message(<EOL>"<STR_LIT>", args=(name, module.name), node=node<EOL>)<EOL>return None<EOL><DEDENT>except astroid.InferenceError:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>if module_names:<EOL><INDENT>modname = module.name if module else "<STR_LIT>"<EOL>self.add_message(<EOL>"<STR_LIT>", node=node, args=("<STR_LIT:.>".join(module_names), modname)<EOL>)<EOL>return None<EOL><DEDENT>if isinstance(module, astroid.Module):<EOL><INDENT>return module<EOL><DEDENT>return None<EOL>
check that module_names (list of string) are accessible through the
        given module
        if the latest access name corresponds to a module, return it