code: def nts(self, s):
          
          # Use the string up to the first null char.
          p = s.find("\0")
          if p == -1:
              return s
          return s[:p]
docs: Convert a null-terminated string field to a python string.