code: def process_headers(data, filename):
      
      headers = []
      if 'toc' in data:
          for element in PyQuery(data['toc'])('a'):
              headers.append(recurse_while_none(element))
          if None in headers:
              log.info('Unable to index file headers for: %s', filename)
      return headers
docs: Read headers from toc data.