def enforce_int(addr):
    """
    helper function to return an int from hex string or int address
    :param addr: (string) if i2c device address in hex,
                (int) if already integer
    :return: int
    """
    if type(addr) == int:
        return addr
    elif type(addr) == str and '0x' in addr:
        return int(addr, 16)
    else:
        raise ValueError('device address must be int or hex string')