def log_str(obj, func, msg):
    """Compose a log message with an object's class name and (optional) function name."""
    if func is None:
        return "{0}: {1}".format(obj.__class__.__name__, msg)
    else:
        return "{0}.{1}(): {2}".format(obj.__class__.__name__, func, msg)