def json_requested():
    """Check if json is the preferred output format for the request."""
    best = request.accept_mimetypes.best_match(
        ['application/json', 'text/html'])
    return (best == 'application/json' and
            request.accept_mimetypes[best] >
            request.accept_mimetypes['text/html'])
def json_requested ( ) : best = request . accept_mimetypes . best_match ( [ 'application/json' , 'text/html' ] ) return ( best == 'application/json' and request . accept_mimetypes [ best ] > request . accept_mimetypes [ 'text/html' ] )
Check if json is the preferred output format for the request.