def unsetbit(x, nth_bit):
    """unset n-th bit (i.e. set to 0) in an integer or array of integers

    Args:
        x: integer or :class:`numpy.ndarray` of integers
        nth_bit: position of bit to be set (0, 1, 2, ..)
    Returns:
        integer or array of integers where n-th bit is unset while all other bits are kept as in input x
    Examples:
        >>> unsetbit(7, 2)
            3
        >>> unsetbit(8, 2)
            8
    """
    if nth_bit < 0:
        raise ValueError('position of bit cannot be negative')
    mask = 1 << nth_bit
    return x & ~mask