def ast_from_module(self, module, modname=None):
modname = modname or module.__name__<EOL>if modname in self.astroid_cache:<EOL><INDENT>return self.astroid_cache[modname]<EOL><DEDENT>try:<EOL><INDENT>filepath = module.__file__<EOL>if modutils.is_python_source(filepath):<EOL><INDENT>return self.ast_from_file(filepath, modname)<EOL><DEDENT><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>from astroid.builder import AstroidBuilder<EOL>return AstroidBuilder(self).module_build(module, modname)<EOL>
given an imported module, return the astroid object