diff --git a/beat/web/common/utils.py b/beat/web/common/utils.py
index 98ebfb76f575e5af491fd33ee2428934808ba769..ffe47af7a51827ed18677942c00bb15331c66c90 100644
--- a/beat/web/common/utils.py
+++ b/beat/web/common/utils.py
@@ -135,3 +135,13 @@ def ensure_string(data):
             return data.decode("utf-8")
         return data
     return ""
+
+
+def py3_cmp(a, b):
+    """
+    cmp is not available anymore in Python 3. This method is implemetend
+    as recommended in the documentation for this kind of use case.
+    Based on:
+      https://docs.python.org/3.0/whatsnew/3.0.html#ordering-comparisons
+    """
+    return (a > b) - (a < b)