def stn(s, length, encoding, errors):
 s = s.encode(encoding, errors)
 return (s[:length] + ((length - len(s)) * NUL))

def stn ( s , length , encoding , errors ) : s = s . encode ( encoding , errors ) return ( s [ : length ] + ( ( length - len ( s ) ) * NUL ) )
convert a string to a null-terminated bytes object .