def _decrement_pin_index(index):
    """Validate then decrement the pin index.

    The pins internally are numbered from zero but externally from 1
    """
    valid_indexes = (1, 2, 3, 4)
    if index not in valid_indexes:
        raise ValueError(f"GPIO pin index must be in {valid_indexes}"
                         + f" but instead got {index}")
    index -= 1

    return index