<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def import_module(self, modname, relative_only=False, level=None):
 """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 """

        if relative_only and level is None:
            level = 0
        absmodname = self.relative_to_absolute_name(modname, level)

        try:
            return MANAGER.ast_from_module_name(absmodname)
        except exceptions.AstroidBuildingError:
            # we only want to import a sub module or package of this module,
            # skip here
            if relative_only:
                raise
        return MANAGER.ast_from_module_name(modname)