Returns the Content Type to serve from either the extension or the
        Accept headers. Uses the :attr:`EXTENSION_MAP` list for all the
        configured MIME types.

def get_content_type(self):
        """Returns the Content Type to serve from either the extension or the
        Accept headers. Uses the :attr:`EXTENSION_MAP` list for all the
        configured MIME types.
        """
        extension = self.path_params.get('_extension')
        for ext, mime in self.EXTENSION_MAP:
            if ext == extension:
                return mime
        # Else: use the Accept headers
        if self.response.vary is None:
            self.response.vary = ['Accept']
        else:
            self.response.vary.append('Accept')
        types = [mime for ext, mime in self.EXTENSION_MAP]
        ct = self.request.accept.best_match(types)
        # No best match found. The specification allows us to either return a
        # 406 or just use another format in this case.
        # We pick the default format, though that may become a configurable
        # behavior in the future.
        if not ct:
            ct = types[0]
        return ct