Factor out a function to convert a line to a pkt-line.