code: def _format(self, ans, q):
          
          if 'fmt' in q:
              fmt = q['fmt'][0]
          else:
              fmt = 'json'
  
          fmt = fmt.lower()
  
          if fmt in self._formatters:
              return (200, self._formatters[fmt](ans, q), 'application/json')
          else:
              return (415,
                  'Invalid fmt request "%s", supported formats are: %s\n'%
                      (fmt, ' '.join(self._formatters.keys()),),
                  'text/plain')
docs: Returns the response tuple according to the selected format.
          A format is available if the method "_format_xxx" is callable.
          The default format is json.