import six
import traceback


def _format_no_chain(exc, tb, limit):
    """Helper for `exc_to_str`."""
    if six.PY2:
        return "".join(traceback.format_exception(type(exc), exc, tb, limit))
    else:
        return "".join(traceback.format_exception(type(exc), exc, tb, limit,
                                                  False))