'Wrapper around set_header to set a content-type.
Args:
media_type: Media type to use for the Content-Type
header.'

def _set_media_type(self, media_type=None):

    set_content_type = ((media_type is not None) and ('content-type' not in self._headers))
    if set_content_type:
        self.set_header('content-type', media_type)
