human
I wrote the below code

    from utils import encode
    out = _dict(message=msg)
    def _raise_exception():
        if raise_exception:
            if flags.rollback_on_exception:
                db.rollback()
            import inspect
            if (inspect.isclass(raise_exception) and issubclass(raise_exception, Exception)):
                raise raise_exception(encode(msg))
            else:
                raise ValidationError(encode(msg))
    if flags.mute_messages:
        _raise_exception()
        return
    if (as_table and (type(msg) in (list, tuple))):
        out.msg = ((u'<table    border="1px"    style="border-collapse:    collapse"    cellpadding="2px">' + u''.join([((u'<tr>' + u''.join([(u'<td>%s</td>' % c) for c in r])) + u'</tr>') for r in msg])) + u'</table>')
    if (flags.print_messages and out.msg):
        print((u'Message:    ' + repr(out.msg).encode(u'utf-8')))
    if title:
        out.title = title
    if ((not indicator) and raise_exception):
        indicator = u'red'
    if indicator:
        out.indicator = indicator
    if alert:
        out.alert = 1
    message_log.append(json.dumps(out))
    _raise_exception()

What's a good function header?
 ... Here's a good function header?
assistant
#Here's a good function header.

def msgprint(msg, title=None, raise_exception=0, as_table=False, indicator=None, alert=False):