'Send a ZAP reply to finish the authentication.'

def _send_zap_reply(self, request_id, status_code, status_text, user_id='anonymous'):

    user_id = (user_id if (status_code == '200') else '')
    if isinstance(user_id, unicode):
        user_id = user_id.encode(self.encoding, 'replace')
    metadata = ''
    self.log.debug('ZAP    reply    code=%s    text=%s', status_code, status_text)
    reply = [VERSION, request_id, status_code, status_text, user_id, metadata]
    self.zap_socket.send_multipart(reply)
