          dict:
              The :class:`Mask` for saving to an alignments file. Contains the keys ``mask``,
              ``affine_matrix``, ``interpolator``, ``stored_size``, ``stored_centering``
          """
          retval = dict()
          for key in ("mask", "affine_matrix", "interpolator", "stored_size", "stored_centering"):
              retval[key] = getattr(self, self._attr_name(key))
          logger.trace({k: v if k != "mask" else type(v) for k, v in retval.items()})
          return retval
  
      def to_png_meta(self):
          """ Convert the mask to a dictionary supported by png itxt headers.
  
 
</s> remove         retval = dict()
        for key in ("mask", "affine_matrix", "interpolator", "stored_size", "stored_centering"):
            val = getattr(self, self._attr_name(key))
            if isinstance(val, np.ndarray):
                retval[key] = val.tolist()
            else:
                retval[key] = val
        logger.trace({k: v if k != "mask" else type(v) for k, v in retval.items()})
        return retval
 </s> add         return self.to_dict(is_png=True) </s> remove     def to_png_meta(self):
 </s> add     def to_png_meta(self) -> MaskAlignmentsFileDict: </s> remove     def from_dict(self, mask_dict):
 </s> add     def from_dict(self, mask_dict: MaskAlignmentsFileDict) -> None: </s> remove         for key in ("mask", "affine_matrix", "interpolator", "stored_size", "stored_centering"):
            val = mask_dict.get(key)
            val = "face" if key == "stored_centering" and val is None else val
            if key == "affine_matrix" and not isinstance(val, np.ndarray):
                val = np.array(val, dtype="float64")
            setattr(self, self._attr_name(key), val)
            logger.trace("%s - %s", key, val if key != "mask" else type(val))

    @staticmethod
    def _attr_name(dict_key):
        """ The :class:`Mask` attribute name for the given dictionary key

        Parameters
        ----------
        dict_key: str
            The key name from an alignments dictionary

        Returns
        -------
        attribute_name: str
            The attribute name for the given key for :class:`Mask`
        """
        retval = "_{}".format(dict_key) if not dict_key.startswith("stored") else dict_key
        logger.trace("dict_key: %s, attribute_name: %s", dict_key, retval)
        return retval
 </s> add         self._mask = mask_dict["mask"]
        affine_matrix = mask_dict["affine_matrix"]
        self._affine_matrix = (affine_matrix if isinstance(affine_matrix, np.ndarray)
                               else np.array(affine_matrix, dtype="float64"))
        self._interpolator = mask_dict["interpolator"]
        self.stored_size = mask_dict["stored_size"]
        centering = mask_dict.get("stored_centering")
        self.stored_centering = "face" if centering is None else centering
        logger.trace({k: v if k != "mask" else type(v)  # type: ignore
                      for k, v in mask_dict.items()})
        assert self._mask is not None
        affine_matrix = self.affine_matrix.tolist() if is_png else self.affine_matrix
        retval = MaskAlignmentsFileDict(mask=self._mask,
                                        affine_matrix=affine_matrix,
                                        interpolator=self.interpolator,
                                        stored_size=self.stored_size,
                                        stored_centering=self.stored_centering)
        logger.trace({k: v if k != "mask" else type(v) for k, v in retval.items()})  # type: ignore
          dict:
              The :class:`Mask` for saving to an alignments file. Contains the keys ``mask``,
              ``affine_matrix``, ``interpolator``, ``stored_size``, ``stored_centering``
          """
        assert self._mask is not None
        affine_matrix = self.affine_matrix.tolist() if is_png else self.affine_matrix
        retval = MaskAlignmentsFileDict(mask=self._mask,
                                        affine_matrix=affine_matrix,
                                        interpolator=self.interpolator,
                                        stored_size=self.stored_size,
                                        stored_centering=self.stored_centering)
        logger.trace({k: v if k != "mask" else type(v) for k, v in retval.items()})  # type: ignore
        assert self._mask is not None
        affine_matrix = self.affine_matrix.tolist() if is_png else self.affine_matrix
        retval = MaskAlignmentsFileDict(mask=self._mask,
                                        affine_matrix=affine_matrix,
                                        interpolator=self.interpolator,
                                        stored_size=self.stored_size,
                                        stored_centering=self.stored_centering)
        logger.trace({k: v if k != "mask" else type(v) for k, v in retval.items()})  # type: ignore
        assert self._mask is not None
        affine_matrix = self.affine_matrix.tolist() if is_png else self.affine_matrix
        retval = MaskAlignmentsFileDict(mask=self._mask,
                                        affine_matrix=affine_matrix,
                                        interpolator=self.interpolator,
                                        stored_size=self.stored_size,
                                        stored_centering=self.stored_centering)
        logger.trace({k: v if k != "mask" else type(v) for k, v in retval.items()})  # type: ignore
        assert self._mask is not None
        affine_matrix = self.affine_matrix.tolist() if is_png else self.affine_matrix
        retval = MaskAlignmentsFileDict(mask=self._mask,
                                        affine_matrix=affine_matrix,
                                        interpolator=self.interpolator,
                                        stored_size=self.stored_size,
                                        stored_centering=self.stored_centering)
        logger.trace({k: v if k != "mask" else type(v) for k, v in retval.items()})  # type: ignore
          return retval
  
      def to_png_meta(self):
          """ Convert the mask to a dictionary supported by png itxt headers.
  
keep keep keep keep replace replace replace replace keep keep keep keep keep
 lib.align updates:
  - alignments.py
    - Add typed dicts for imported alignments
    - Explicitly check for presence of thumb value in alignments dict
    - linting
  - detected_face.py
    - Typing
    - Linting
    - Legacy support for pre-aligned face
    - Update dependencies to new property names 
lib/align/detected_face.py