Reuse theano.compat.cmp.  (Suggested by @lamblin.)