def isbitset(x, nth_bit):
    """check if n-th bit is set (==1) in x

    Args:
        x: integer or :class:`numpy.ndarray` of integers
        nth_bit: position of investigated bit (0, 1, 2, ...)
    Returns:
        boolean or boolean array denoting whether the nth_bit is set in x.
    Examples:
        >>> isbitset(3, 0)
            True
        >>> isbitset(2, 0)
            False
    """
    if nth_bit < 0:
        raise ValueError('position of bit cannot be negative')
    mask = 1 << nth_bit
    return x & mask > 0