def stripnull(string):
 i = string.find('\x00')
 return (string if (i < 0) else string[:i])

def stripnull ( string ) : i = string . find ( '\x00' ) return ( string if ( i < 0 ) else string [ : i ] )
return string truncated at first null character .