sagenb.notebook.interact.SAGE_CELL_ID is exactly what I want. For more information see this answer: http://ask.sagemath.org/question/8954/how-can-a-cell-output-its-own-id/. Big thanks to kcrisman.