def callsign(msg):
    """Aircraft callsign

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

    Returns:
        string: callsign
    """

    if common.typecode(msg) < 1 or common.typecode(msg) > 4:
        raise RuntimeError("%s: Not a identification message" % msg)

    chars = '#ABCDEFGHIJKLMNOPQRSTUVWXYZ#####_###############0123456789######'
    msgbin = common.hex2bin(msg)
    csbin = msgbin[40:96]

    cs = ''
    cs += chars[common.bin2int(csbin[0:6])]
    cs += chars[common.bin2int(csbin[6:12])]
    cs += chars[common.bin2int(csbin[12:18])]
    cs += chars[common.bin2int(csbin[18:24])]
    cs += chars[common.bin2int(csbin[24:30])]
    cs += chars[common.bin2int(csbin[30:36])]
    cs += chars[common.bin2int(csbin[36:42])]
    cs += chars[common.bin2int(csbin[42:48])]

    # clean string, remove spaces and marks, if any.
    # cs = cs.replace('_', '')
    cs = cs.replace('#', '')
    return cs
def callsign ( msg ) : if common . typecode ( msg ) < 1 or common . typecode ( msg ) > 4 : raise RuntimeError ( "%s: Not a identification message" % msg ) chars = '#ABCDEFGHIJKLMNOPQRSTUVWXYZ#####_###############0123456789######' msgbin = common . hex2bin ( msg ) csbin = msgbin [ 40 : 96 ] cs = '' cs += chars [ common . bin2int ( csbin [ 0 : 6 ] ) ] cs += chars [ common . bin2int ( csbin [ 6 : 12 ] ) ] cs += chars [ common . bin2int ( csbin [ 12 : 18 ] ) ] cs += chars [ common . bin2int ( csbin [ 18 : 24 ] ) ] cs += chars [ common . bin2int ( csbin [ 24 : 30 ] ) ] cs += chars [ common . bin2int ( csbin [ 30 : 36 ] ) ] cs += chars [ common . bin2int ( csbin [ 36 : 42 ] ) ] cs += chars [ common . bin2int ( csbin [ 42 : 48 ] ) ] cs = cs . replace ( '#' , '' ) return cs
Aircraft callsign

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

    Returns:
        string: callsign