| Formats given exception.
    | The code produce a similar output to :func:`traceback.format_exception` except that it allows frames to be excluded
        from the stack if the given stack trace frame tag is found in the frame locals and set **True**.

    :param cls: Exception class.
    :type cls: object
    :param instance: Exception instance.
    :type instance: object
    :param trcback: Traceback.
    :type trcback: Traceback
    :param context: Context being included.
    :type context: int
    :return: Formated exception.
    :rtype: list

def format_exception(cls, instance, trcback, context=1):
    """
    | Formats given exception.
    | The code produce a similar output to :func:`traceback.format_exception` except that it allows frames to be excluded
        from the stack if the given stack trace frame tag is found in the frame locals and set **True**.

    :param cls: Exception class.
    :type cls: object
    :param instance: Exception instance.
    :type instance: object
    :param trcback: Traceback.
    :type trcback: Traceback
    :param context: Context being included.
    :type context: int
    :return: Formated exception.
    :rtype: list
    """

    stack = extract_stack(get_inner_most_frame(trcback), context=context)
    output = []
    output.append("Traceback (most recent call last):")
    for frame, file_name, line_number, name, context, index in stack:
        output.append("  File \"{0}\", line {1}, in {2}".format(file_name, line_number, name))
        for line in context:
            output.append("    {0}".format(line.strip()))
    for line in traceback.format_exception_only(cls, instance):
        output.append("{0}".format(line))
    return output