def get_kpoints(content):
    """Read a list of kpoints and their weights from kgrid.x output file."""
    lines = content.splitlines()[2:]
    kpoints = list()
    weights = list()
    for line in lines:
        k = [ float(ki) for ki in line.split()[:3] ]
        w = float(line.split()[-1])
        kpoints.append(k)
        weights.append(w)
    return kpoints, weights