code: def is_valid(container, path):
      
      try:
          tmp_hash_path = container.filename + ".hash"
          with open(tmp_hash_path, 'r') as tmp_file:
              tmp_hash = tmp_file.readline()
      except IOError:
          LOG.info("No .hash-file in the tmp-directory.")
  
      container_hash_path = local.path(path) / "gentoo.tar.bz2.hash"
      if container_hash_path.exists():
          with open(container_hash_path, 'r') as hash_file:
              container_hash = hash_file.readline()
              return container_hash == tmp_hash
      return False
docs: Checks if a container exists and is unpacked.
  
      Args:
          path: The location where the container is expected.
  
      Returns:
          True if the container is valid, False if the container needs to
          unpacked or if the path does not exist yet.