def not_found_response(msg, path):
    '''Respond with an error message and 404.'''
    msg.set_status(Soup.Status.NOT_FOUND)
    error = serialize_error_as_json_object(
        EosCompanionAppService.error_quark(),
        EosCompanionAppService.Error.INVALID_REQUEST,
        detail={'invalid_path': path})
    EosCompanionAppService.set_soup_message_response(
        msg, 'application/json', json.dumps({
            'status': 'error',
            'error': error
        }))
def html_response(msg, html):
    '''Respond with an HTML body.'''
    msg.set_status(Soup.Status.OK)
    EosCompanionAppService.set_soup_message_response(msg, 'text/html', html)
def json_response(msg, obj):
    '''Respond with a JSON object'''
    msg.set_status(Soup.Status.OK)
    EosCompanionAppService.set_soup_message_response(msg, 'application/json',
                                                     json.dumps(obj))