docs: def sitemap(request):
      """Return a sitemap xml file for search engines."""
      xml = Sitemap()
      author = request.matchdict.get('from_id')
      if author is not None:
          match = "AND '{}' = authors[1]".format(author)
      else:
          match = ''
  
      with db_connect() as db_connection:
          with db_connection.cursor() as cursor:
              cursor.execute("""SELECT
                      ident_hash(uuid, major_version, minor_version)
                          AS idver,
                      name,
                      revised
                  FROM latest_modules
                  WHERE portal_type NOT IN ('CompositeModule', 'SubCollection')
                  {}
                  ORDER BY module_ident DESC""".format(match))
              res = cursor.fetchall()
              for ident_hash, page_name, revised in res:
                  #  replace punctuation with whitespace
                  page_name = re.sub(NON_WORD, ' ',
                                     page_name.decode('utf-8'), re.UNICODE)
                  # remove leading and trailing whitespace
                  page_name = page_name.strip().encode('utf-8')
                  # replace spaces with dashes
                  page_name = re.sub(' +', '-',
                                     page_name.decode('utf-8'), re.UNICODE)
                  url = request.route_url('content',
                                          ident_hash=ident_hash,
                                          ignore=u'/{}'.format(page_name))
                  if notblocked(url):
                      xml.add_url(url, lastmod=revised)
  
      resp = request.response
      resp.status = '200 OK'
      resp.content_type = 'text/xml'
      resp.body = xml()
      return resp