def excstr(e):
    """Return a string for the exception.

    The string will be in the format that Python normally outputs
    in interactive shells and such:
        <ExceptionName>: <message>
        AttributeError: 'object' object has no attribute 'bar'
    Neither str(e) nor repr(e) do that.
    """
    if e is None:
        return None
    return '%s: %s' % (e.__class__.__name__, e)