          try:
              with open(filename, self._write_option) as s_file:
                  s_file.write(self.marshal(data))
          except IOError as err:
              msg = "Error writing to '{}': {}".format(filename, err.strerror)
              raise FaceswapError(msg) from err
  
      def _check_extension(self, filename):
          """ Check the filename has an extension. If not add the correct one for the serializer """
          extension = os.path.splitext(filename)[1]
 
</s> remove         retval = filename if extension else "{}.{}".format(filename, self.file_extension)
 </s> add         retval = filename if extension else f"{filename}.{self.file_extension}" </s> remove             msg = "Error reading from '{}': {}".format(filename, err.strerror)
 </s> add             msg = f"Error reading from '{filename}': {err.strerror}" </s> remove             msg = "Error unserializing data for type {}: {}".format(type(serialized_data),
                                                                    str(err))
 </s> add             msg = f"Error unserializing data for type {type(serialized_data)}: {str(err)}" </s> remove             msg = "Error serializing data for type {}: {}".format(type(data), str(err))
 </s> add             msg = f"Error serializing data for type {type(data)}: {str(err)}" </s> remove     elif extension in (".yaml", ".yml") and yaml is not None:
 </s> add     elif extension in (".yaml", ".yml") and _HAS_YAML:
            msg = f"Error writing to '{filename}': {err.strerror}"
          try:
              with open(filename, self._write_option) as s_file:
                  s_file.write(self.marshal(data))
          except IOError as err:
            msg = f"Error writing to '{filename}': {err.strerror}"
              raise FaceswapError(msg) from err
  
      def _check_extension(self, filename):
          """ Check the filename has an extension. If not add the correct one for the serializer """
          extension = os.path.splitext(filename)[1]
keep keep keep keep replace keep keep keep keep keep
 Core updates
   - Change loss loading mechanism
   - Autosize tooltips based on content size
   - Random linting + code modernisation 
lib/serializer.py