def copy(reader, writer, start, stop, insertLocation=None, tsCol=None):
assert stop >= start<EOL>startRows = []<EOL>copyRows = []<EOL>ts = None<EOL>inc = None<EOL>if tsCol is None:<EOL><INDENT>tsCol = reader.getTimestampFieldIdx()<EOL><DEDENT>for i, row in enumerate(reader):<EOL><INDENT>if ts is None:<EOL><INDENT>ts = row[tsCol]<EOL><DEDENT>elif inc is None:<EOL><INDENT>inc = row[tsCol] - ts<EOL><DEDENT>if i >= start and i <= stop:<EOL><INDENT>copyRows.append(row)<EOL><DEDENT>startRows.append(row)<EOL><DEDENT>if insertLocation is None:<EOL><INDENT>insertLocation = stop + <NUM_LIT:1><EOL><DEDENT>startRows[insertLocation:insertLocation] = copyRows<EOL>for row in startRows:<EOL><INDENT>row[tsCol] = ts<EOL>writer.appendRecord(row)<EOL>ts += inc<EOL><DEDENT>
Copies a range of values to a new location in the data set.

    Args:
      reader: A FileRecordStream object with input data.
      writer: A FileRecordStream object to write output data to.
      start: The first row in the range to copy.
      stop: The last row in the range to copy.
      insertLocation: The location to insert the copied range. If not specified,
          the range is inserted immediately following itself.