def accepts_content_type(request, content_type):
  """Determine if the request wants the given content_type as a response."""
  if not hasattr(request, 'headers'):
    return False
  accept = request.headers.get('accept', None)
  if not accept:
    return None
  return content_type in str(accept)