def accepts_content_type(request, content_type):
 if (not hasattr(request, 'headers')):
  return False
 accept = request.headers.get('accept', None)
 if (not accept):
  return None
 return (content_type in str(accept))

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