I have used hashlib (which replaces md5 in Python 2.6/3.0) and it worked fine if I opened a file and put its content in hashlib.md5 function.
The problem is with very big files that their sizes could exceed RAM size.
How to get a MD5 hash of a file without open it?