code: def _is_kpoint(line):
      
      # Try to parse the k-point; false otherwise
      toks = line.split()
      # k-point header lines have 4 tokens
      if len(toks) != 4:
          return False
  
      try:
          # K-points are centered at the origin
          xs = [float(x) for x in toks[:3]]
          # Weights are in [0,1]
          w = float(toks[3])
          return all(abs(x) <= 0.5 for x in xs) and w >= 0.0 and w <= 1.0
      except ValueError:
          return False
docs: Is this line the start of a new k-point block