code: def set_version(request, response):
      
      settings = request.registry.settings
      resolver = DottedNameResolver()
  
      # get version config
      version_header = settings.get(
          'api.version_header',
          'X-Version',
      )
      version_header_value = settings.get('api.version_header_value')
      if callable(version_header_value):
          version_header_value = version_header_value()
      elif version_header_value:
          version_header_value = resolver.resolve(version_header_value)
  
      # get revision config
      revision_header = settings.get(
          'api.revision_header',
          'X-Revision',
      )
      revision_header_value = settings.get('api.revision_header_value')
      if callable(revision_header_value):
          revision_header_value = revision_header_value()
      elif revision_header_value:
          revision_header_value = resolver.resolve(revision_header_value)
  
      if version_header and version_header_value:
          response.headers[str(version_header)] = str(version_header_value)
      if revision_header and revision_header_value:
          response.headers[str(revision_header)] = str(revision_header_value)
docs: Set version and revision to response