def isKthBitSet(n, k):
    """
    Function to check if a certain bit of a number is set (required to analyse quality flags)
    """
    if n & (1 << (k - 1)):
        return 1
    else:
        return 0