def md5_hexdigest(file):
 if isinstance(file, compat.string_types):
  with open(file, u'rb') as infile:
   return _md5_hexdigest(infile)
 return _md5_hexdigest(file)

def md5_hexdigest ( file ) : if isinstance ( file , compat . string_types ) : with open ( file , u'rb' ) as infile : return _md5_hexdigest ( infile ) return _md5_hexdigest ( file )
calculate and return the md5 checksum for a given file .