Formats given exception as a text.

        :param \*args: Arguments.
        :type \*args: \*
        :return: Exception text.
        :rtype: unicode

def formatTextException(*args):
        """
        Formats given exception as a text.

        :param \*args: Arguments.
        :type \*args: \*
        :return: Exception text.
        :rtype: unicode
        """

        format = lambda x: re.sub(r"^(\s+)", lambda y: "{0} ".format("." * len(y.group(0))), x.rstrip().expandtabs(4))

        verbose = 10
        cls, instance, trcback = args
        stack = foundations.exceptions.extract_stack(foundations.exceptions.get_inner_most_frame(trcback), verbose)

        text = []
        text.append(foundations.strings.to_string(cls))
        text.append("")

        for line in foundations.exceptions.format_exception(cls, instance, trcback):
            text.append(format("{0}".format(format(line))))
        text.append("")

        text.append("An unhandled exception occured in {0} {1}!".format(Constants.application_name,
                                                                        Constants.version))
        text.append("Sequence of calls leading up to the exception, in their occurring order:")
        text.append("")

        for frame, file_name, line_number, name, context, index in stack:
            location = "{0}{1}".format(name if name != "<module>" else "",
                                       inspect.formatargvalues(*inspect.getargvalues(frame)))
            text.append("File \"{0}\", line {1}, in {2}".format(file_name, line_number, location))
            for i, line in enumerate(context):
                if i == index:
                    text.append(format("\t{0} {1} <===".format(line_number - index + i, format(format(line)))))
                else:
                    text.append(format("\t{0} {1}".format(line_number - index + i, format(format(line)))))
            text.append("")
        for line in traceback.format_exception_only(cls, instance):
            text.append("{0}".format(format(line)))
        text.append("")

        text.append("Frames locals by stack ordering, innermost last:")
        text.append("")
        for frame, locals in foundations.exceptions.extract_locals(trcback):
            name, file_name, line_number = frame
            text.append("Frame \"{0}\" in \"{1}\" file, line {2}:".format(name, file_name, line_number))
            arguments, nameless_args, keyword_args, locals = locals
            has_arguments, has_locals = any((arguments, nameless_args, keyword_args)), any(locals)
            has_arguments and text.append(format("\tArguments:"))
            for key, value in arguments.iteritems():
                text.append(format("\t\t{0} = {1}".format(key, value)))
            for value in nameless_args:
                text.append(format("\t\t{0}".format(value)))
            for key, value in sorted(keyword_args.iteritems()):
                text.append(format("\\tt{0} = {1}".format(key, value)))
            has_locals and text.append(format("\tLocals:"))
            for key, value in sorted(locals.iteritems()):
                text.append(format("\t\t{0} = {1}".format(key, value)))
            text.append("")

        return text