def constant_time_string_compare(a, b):
    """Helper for comparing string in constant time, independent
    of the python version being used.

    Args:
        a (str): A string to compare
        b (str): A string to compare
    """

    try:
        return hmac.compare_digest(a, b)
    except AttributeError:

        if len(a) != len(b):
            return False

        result = 0

        for x, y in zip(a, b):
            result |= ord(x) ^ ord(y)

        return result == 0
Helper for comparing string in constant time, independent
    of the python version being used.

    Args:
        a (str): A string to compare
        b (str): A string to compare