What you usually do is that you store the Markdown input from the user as text, and render it to HTML when you have to display it. (If you're in dire need of performance, you can always cache that).
When you need to modify it, you modify the Markdown input again, not the HTML.
To do the Markdown -> HTML conversion in python, you can use the Markdown library.
You're not really supposed to be turning HTML back into Markdown (Markdown is not as rich formatting-wise as HTML is, so you might lose some formatting), but the python library html2text happens to output valid Markdown - you can't guarantee the Markdown itself will convert to your initial HTML though!
Nevertheless, please keep in mind that as always when outputting client-submitted data, you must take into consideration security risks such as cross-site scripting. You can see an example at this Django ticket.
You could go to this security.stackexchange.com question for more detail.
Actually, the lack of security in the Python Markdown library (among others) has played a role in django.utils.markup
being deprecated in Django 1.5.