code: def __dbfHeader(self):
          
          if not self.dbf:
              raise ShapefileException("Shapefile Reader requires a shapefile or file-like object. (no dbf file found)")
          dbf = self.dbf
          headerLength = self.__dbfHeaderLength()
          numFields = (headerLength - 33) // 32
          for field in range(numFields):
              fieldDesc = list(unpack("<11sc4xBB14x", dbf.read(32)))
              name = 0
              idx = 0
              if b("\x00") in fieldDesc[name]:
                  idx = fieldDesc[name].index(b("\x00"))
              else:
                  idx = len(fieldDesc[name]) - 1
              fieldDesc[name] = fieldDesc[name][:idx]
              fieldDesc[name] = u(fieldDesc[name])
              fieldDesc[name] = fieldDesc[name].lstrip()
              fieldDesc[1] = u(fieldDesc[1])
              self.fields.append(fieldDesc)
          terminator = dbf.read(1)
          assert terminator == b("\r")
          self.fields.insert(0, ('DeletionFlag', 'C', 1, 0))
docs: Reads a dbf header. Xbase-related code borrows heavily from ActiveState Python Cookbook Recipe 362715 by Raymond Hettinger