code: def selection_paste_data_gen(self, selection, data, freq=None):
          
  
          (bb_top, bb_left), (bb_bottom, bb_right) = \
              selection.get_grid_bbox(self.grid.code_array.shape)
          bbox_height = bb_bottom - bb_top + 1
          bbox_width = bb_right - bb_left + 1
  
          for row, row_data in enumerate(itertools.cycle(data)):
              # Break if row is not in selection bbox
              if row >= bbox_height:
                  break
  
              # Duplicate row data if selection is wider than row data
              row_data = list(row_data)
              duplicated_row_data = row_data * (bbox_width // len(row_data) + 1)
              duplicated_row_data = duplicated_row_data[:bbox_width]
  
              for col in xrange(len(duplicated_row_data)):
                  if (bb_top, bb_left + col) not in selection:
                      duplicated_row_data[col] = None
  
              yield duplicated_row_data
docs: Generator that yields data for selection paste