def _get_hash(filename, block_size=(2 ** 20), hash=hashlib.md5):
 f = open(filename, 'rb')
 hash_ = hash()
 while True:
  data = f.read(block_size)
  if (not data):
   break
  hash_.update(data)
 return hash_.hexdigest()

def _get_hash ( filename , block_size = ( 2 ** 20 ) , hash = hashlib . md5 ) : f = open ( filename , 'rb' ) hash_ = hash ( ) while True : data = f . read ( block_size ) if ( not data ) : break hash_ . update ( data ) return hash_ . hexdigest ( )
returns an md5 hash for a filename .