<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def error2str(e):
 """returns the formatted stacktrace of the exception `e`. :param BaseException e: an exception to format into str :rtype: str """

    out = StringIO()
    traceback.print_exception(None, e, e.__traceback__, file=out)
    out.seek(0)
    return out.read()