def turn_off_last_bit(S):
    """
    Turns off the rightmost 1-bit in a word, producing 0 if none.

    By product, the position of toggled 1-bit is returned, -1 if none.

    Examples
    ========

    When a 1-bit is present:
    >>> S, b = turn_off_last_bit(0b1011000)
    >>> bin(S)
    '0b1010000'
    >>> b
    3

    When a 1-bit is the very least bit:
    >>> S, b = turn_off_last_bit(0b1)
    >>> bin(S)
    '0b0'
    >>> b
    0

    When a 1-bit is *not* present:
    >>> S, b = turn_off_last_bit(0b0)
    >>> bin(S)
    '0b0'
    >>> b
    -1

    """
    SS = S & (S - 1)
    b = (SS ^ S).bit_length() - 1
    return (SS, b) if S else (SS, -1)