def get_bit(number, position):
    """Returns the bit at the given position of the given number. The position
    is counted starting from the left in the binary representation (from the most
    significant to the least significant bit).
    """
    if position < 0 or position > 31:
        return 0
    return (number >> (31 - position)) & 1