def renumber_code_cell()

in util-cell-enumerate.py [0:0]


def renumber_code_cell(code_cell):
  global cell_number

  # strip any old numbers
  code_cell["source"] = [ line_of_code for line_of_code in code_cell["source"] if not has_cell_number.match(line_of_code)]

  # add a new  number
  insert_at_line_number=0 # in general, add to the beginning of the block
  if len(code_cell["source"])>0 and code_cell["source"][0].startswith('%%sh'): 
    # this is rare case where line number cannot be prepended to the block
    insert_at_line_number=1
  code_cell["source"].insert(insert_at_line_number,'# cell {:02d}\n'.format(cell_number))
  cell_number += 1
  return code_cell