def is40(msg):
    """Check if a message is likely to be BDS code 4,0

    Args:
        msg (String): 28 bytes hexadecimal message string

    Returns:
        bool: True or False
    """

    if allzeros(msg):
        return False

    d = hex2bin(data(msg))

    # status bit 1, 14, and 27

    if wrongstatus(d, 1, 2, 13):
        return False

    if wrongstatus(d, 14, 15, 26):
        return False

    if wrongstatus(d, 27, 28, 39):
        return False

    if wrongstatus(d, 48, 49, 51):
        return False

    if wrongstatus(d, 54, 55, 56):
        return False

    # bits 40-47 and 52-53 shall all be zero

    if bin2int(d[39:47]) != 0:
        return False

    if bin2int(d[51:53]) != 0:
        return False

    return True
def is40 ( msg ) : if allzeros ( msg ) : return False d = hex2bin ( data ( msg ) ) if wrongstatus ( d , 1 , 2 , 13 ) : return False if wrongstatus ( d , 14 , 15 , 26 ) : return False if wrongstatus ( d , 27 , 28 , 39 ) : return False if wrongstatus ( d , 48 , 49 , 51 ) : return False if wrongstatus ( d , 54 , 55 , 56 ) : return False if bin2int ( d [ 39 : 47 ] ) != 0 : return False if bin2int ( d [ 51 : 53 ] ) != 0 : return False return True
Check if a message is likely to be BDS code 4,0

    Args:
        msg (String): 28 bytes hexadecimal message string

    Returns:
        bool: True or False