docs: def v1_highlights_get(response, kvlclient, file_id_str, max_elapsed = 300):
      '''Obtain highlights for a document POSTed previously to this end
      point.  See documentation for v1_highlights_post for further
      details.  If the `state` is still `pending` for more than
      `max_elapsed` after the start of the `WorkUnit`, then this reports
      an error, although the `WorkUnit` may continue in the background.
  
      '''
      file_id = make_file_id(file_id_str)
      kvlclient.setup_namespace(highlights_kvlayer_tables)
      payload_strs = list(kvlclient.get('highlights', file_id))
      if not (payload_strs and payload_strs[0][1]):
          response.status = 500
          payload = {
              'state': ERROR,
              'error': {
                  'code': 8,
                  'message': 'unknown error'}}
          logger.critical('got bogus info for %r: %r', file_id, payload_strs)
      else:
          payload_str = payload_strs[0][1]
          try:
              payload = json.loads(payload_str)
              if payload['state'] == HIGHLIGHTS_PENDING:
                  elapsed = time.time() - payload.get('start', 0)
                  if elapsed > max_elapsed:
                      response.status = 500
                      payload = {
                          'state': ERROR,
                          'error': {
                              'code': 8,
                              'message': 'hit timeout'}}
                      logger.critical('hit timeout on %r', file_id)
                      kvlclient.put('highlights', (file_id, json.dumps(payload)))
                  else:
                      payload['elapsed'] = elapsed
              logger.info('returning stored payload for %r', file_id)
          except Exception, exc:
              logger.critical('failed to decode out of %r', 
                              payload_str, exc_info=True)
              response.status = 400
              payload = {
                  'state': ERROR,
                  'error': {
                      'code': 9,
                      'message': 'nothing known about file_id=%r' % file_id}
                  }
      # only place where payload is returned
      return payload