added coded to ipython notebook