code: def nti(s):
      
      # There are two possible encodings for a number field, see
      # itn() below.
      if s[0] != chr(0o200):
          try:
              n = int(nts(s, "ascii", "strict") or "0", 8)
          except ValueError:
              raise InvalidHeaderError("invalid header")
      else:
          n = 0
          for i in range(len(s) - 1):
              n <<= 8
              n += ord(s[i + 1])
      return n
docs: Convert a number field to a python number.