docs: def map(self, response):
          """
          Process *response* and return a list of (table, rowdata) tuples.
          """
          inserts = []
  
          parse = {}
          # custom remapping, cleanup, and filling in holes
          parse['i-id'] = response.get('keys', {}).get('i-id', -1)
          self._parse_id = max(self._parse_id + 1, parse['i-id'])
          parse['parse-id'] = self._parse_id
          parse['run-id'] = response.get('run', {}).get('run-id', -1)
          if 'tokens' in response:
              parse['p-input'] = response['tokens'].get('initial')
              parse['p-tokens'] = response['tokens'].get('internal')
              if 'ninputs' not in response:
                  toks = response.tokens('initial')
                  if toks is not None:
                      response['ninputs'] = len(toks.tokens)
              if 'ntokens' not in response:
                  toks = response.tokens('internal')
                  if toks is not None:
                      response['ntokens'] = len(toks.tokens)
          if 'readings' not in response and 'results' in response:
              response['readings'] = len(response['results'])
          # basic mapping
          for key in self._parse_keys:
              if key in response:
                  parse[key] = response[key]
          inserts.append(('parse', parse))
  
          for result in response.get('results', []):
              d = {'parse-id': self._parse_id}
              if 'flags' in result:
                  d['flags'] = SExpr.format(result['flags'])
              for key in self._result_keys:
                  if key in result:
                      d[key] = result[key]
              inserts.append(('result', d))
  
          if 'run' in response:
              run_id = response['run'].get('run-id', -1)
              # check if last run was not closed properly
              if run_id not in self._runs and self._last_run_id in self._runs:
                  last_run = self._runs[self._last_run_id]
                  if 'end' not in last_run:
                      last_run['end'] = datetime.now()
              self._runs[run_id] = response['run']
              self._last_run_id = run_id
  
          return inserts