def exception_string(e):
    """Return an interpreter like error string from an exception."""
    s = type(e).__name__

    # If e is not a built-in exception add module to exception name.
    if hasattr(e, '__module__'):
        s = '{}.{}'.format(e.__module__, s)

    # If e has a message add ':' and message.
    if str(e) != '':
        s = '{}: {}'.format(s, str(e))

    return s