<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def error(msg, details=None):
    '''Display an error message with optional details'''
    msg = '{0} {1}'.format(red(KO), white(safe_unicode(msg)))
    msg = safe_unicode(msg)
    if details:
        msg = b'\n'.join((msg, safe_unicode(details)))
    echo(format_multiline(msg))