Return an error message and write a log file if logging was not enabled.

    Args:
        exc: The unexpected exception.

    Returns:
        A message to display to the user concerning the unexpected exception.

def handle_unexpected_exception(exc):
    # type: (BaseException) -> str
    """Return an error message and write a log file if logging was not enabled.

    Args:
        exc: The unexpected exception.

    Returns:
        A message to display to the user concerning the unexpected exception.
    """
    try:
        write_logfile()
        addendum = 'Please see the log file for more information.'
    except IOError:
        addendum = 'Unable to write log file.'
    try:
        message = str(exc)
        return '{}{}{}'.format(message, '\n' if message else '', addendum)
    except Exception:  # pylint: disable=broad-except
        return str(exc)