def import_module(self, modname, relative_only=False, level=None):
if relative_only and level is None:<EOL><INDENT>level = <NUM_LIT:0><EOL><DEDENT>absmodname = self.relative_to_absolute_name(modname, level)<EOL>try:<EOL><INDENT>return MANAGER.ast_from_module_name(absmodname)<EOL><DEDENT>except exceptions.AstroidBuildingError:<EOL><INDENT>if relative_only:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>return MANAGER.ast_from_module_name(modname)<EOL>
Get the ast for a given module as if imported from this module.

        :param modname: The name of the module to "import".
        :type modname: str

        :param relative_only: Whether to only consider relative imports.
        :type relative_only: bool

        :param level: The level of relative import.
        :type level: int or None

        :returns: The imported module ast.
        :rtype: NodeNG