'Parse a scale\'s answer to a weighing request, returning
a `(weight, weight_info, status)` pair.'

def _parse_weight_answer(self, protocol, answer):

    (weight, weight_info, status) = (None, None, None)
    try:
        _logger.debug('Parsing    weight    [%r]', answer)
        if ((not answer) and protocol.emptyAnswerValid):
            return (weight, weight_info, status)
        if (protocol.statusRegexp and re.search(protocol.statusRegexp, answer)):
            (weight, weight_info) = protocol.statusParse(answer)
        else:
            match = re.search(protocol.weightRegexp, answer)
            if match:
                weight_text = match.group(1)
                try:
                    weight = float(weight_text)
                    _logger.info('Weight:    %s', weight)
                except ValueError:
                    _logger.exception('Cannot    parse    weight    [%r]', weight_text)
                    status = 'Invalid    weight,    please    power-cycle    the    scale'
            else:
                _logger.error('Cannot    parse    scale    answer    [%r]', answer)
                status = 'Invalid    scale    answer,    please    power-cycle    the    scale'
    except Exception as e:
        _logger.exception('Cannot    parse    scale    answer    [%r]', answer)
        status = ('Could    not    weigh    on    scale    %s    with    protocol    %s:    %s' % (self.path_to_scale, protocol.name, e))
    return (weight, weight_info, status)
