code: def rehash(path, blocksize=1 << 20):
      # type: (str, int) -> Tuple[str, str]
      
      h = hashlib.sha256()
      length = 0
      with open(path, 'rb') as f:
          for block in read_chunks(f, size=blocksize):
              length += len(block)
              h.update(block)
      digest = 'sha256=' + urlsafe_b64encode(
          h.digest()
      ).decode('latin1').rstrip('=')
      # unicode/str python2 issues
      return (digest, str(length))
docs: Return (hash, length) for path using hashlib.sha256()