docs: def create_highlights(data, tfidf):
      '''compute highlights for `data`, store it in the store using
      `kvlclient`, and return a `highlights` response payload.
  
      '''
      try:
          fc = etl.create_fc_from_html(
              data['content-location'], data['body'], tfidf=tfidf, encoding=None)
      except Exception, exc:
          logger.critical('failed to build FC', exc_info=True)
          return {
              'state': ERROR,
              'error': {'code': 7,
                        'message': 'internal error: %s' % traceback.format_exc(exc),
                        }
          }
      if fc is None:
          logger.critical('failed to get FC using %d bytes from %r',
                          len(body), data['content-location'])
          response.status = 500
          return {
              'state': ERROR,
              'error': {
                  'code': 7,
                  'message': 'internal error: FC not generated for that content',
              },
          }
      try:
          highlights = dict()
          for feature_name, pretty_name in feature_pretty_names:
              # Each type of string is
              if feature_name not in fc:
                  continue
              total = sum(fc[feature_name].values())
              bow = sorted(fc[feature_name].items(), key=itemgetter(1), reverse=True)
              highlights[pretty_name] = [(phrase, count / total)
                                         for phrase, count in bow]
              logger.info('%r and %d keys',
                          feature_name, len(highlights[pretty_name]))
  
          highlight_objs = build_highlight_objects(data['body'], highlights)
      except Exception, exc:
          logger.critical('failed to build highlights', exc_info=True)
          return {
              'state': ERROR,
              'error': {'code': 7,
                        'message': 'internal error: %s' % traceback.format_exc(exc),
                        }
          }
  
      payload = {
          'highlights': highlight_objs,
          'state': COMPLETED,
      }
      return payload