def id_to_int(id_):
    """
    Convert a ZMQ client ID to printable integer
    This is needed to log client IDs while maintaining Python cross-version
    compatibility (so we can't use bytes.hex() for example)
    """
    i = 0
    for c in id_:
        if not isinstance(c, int):
            c = ord(c)
        i = (i << 8) + c
    return i