<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def relative_to_absolute_name(self, modname, level):
 """Get the absolute module name for a relative import. The relative import can be implicit or explicit. :param modname: The module name to convert. :type modname: str :param level: The level of relative import. :type level: int :returns: The absolute module name. :rtype: str :raises TooManyLevelsError: When the relative import refers to a module too far above this one. """

        # XXX this returns non sens when called on an absolute import
        # like 'pylint.checkers.astroid.utils'
        # XXX doesn't return absolute name if self.name isn't absolute name
        if self.absolute_import_activated() and level is None:
            return modname
        if level:
            if self.package:
                level = level - 1
            if level and self.name.count(".") < level:
                raise exceptions.TooManyLevelsError(level=level, name=self.name)

            package_name = self.name.rsplit(".", level)[0]
        elif self.package:
            package_name = self.name
        else:
            package_name = self.name.rsplit(".", 1)[0]

        if package_name:
            if not modname:
                return package_name
            return "%s.%s" % (package_name, modname)
        return modname