def METHOD_NAME(dicom_datasets, index_to_copy, number_of_slices):
    if index_to_copy == 0:
        slice_diff = (
            dicom_datasets[0].ImagePositionPatient[-1]
            - dicom_datasets[1].ImagePositionPatient[-1]
        )
    elif index_to_copy == len(dicom_datasets) or index_to_copy == -1:
        slice_diff = (
            dicom_datasets[-1].ImagePositionPatient[-1]
            - dicom_datasets[-2].ImagePositionPatient[-1]
        )
    else:
        raise ValueError("index_to_copy must be first or last slice")
    new_slice_locations = [
        dicom_datasets[index_to_copy].ImagePositionPatient[-1] + slice_diff
    ]
    for _ in range(number_of_slices - 1):
        new_slice_locations.append(new_slice_locations[-1] + slice_diff)
    return new_slice_locations