code: def get_file_md5(filename):
      
      if os.path.exists(filename):
          blocksize = 65536
          try:
              hasher = hashlib.md5()
          except BaseException:
              hasher = hashlib.new('md5', usedForSecurity=False)
          with open(filename, 'rb') as afile:
              buf = afile.read(blocksize)
              while len(buf) > 0:  # pylint: disable=len-as-condition
                  hasher.update(buf)
                  buf = afile.read(blocksize)
          return hasher.hexdigest()
  
      return ''
docs: Get a file's MD5