def doc_checksum(docstr):
 import hashlib
 converted = hashlib.sha1(docstr).hexdigest()
 return converted

def doc_checksum ( docstr ) : import hashlib converted = hashlib . sha1 ( docstr ) . hexdigest ( ) return converted
calculate a checksum for a file .