      elif serializer.lower() == "pickle":
          retval = _PickleSerializer()
      elif serializer.lower() == "yaml" and yaml is not None:
          retval = _YAMLSerializer()
      elif serializer.lower() == "yaml" and yaml is None:
          logger.warning("You must have PyYAML installed to use YAML as the serializer."
                         "Switching to JSON as the serializer.")
          retval = _JSONSerializer
      else:
          logger.warning("Unrecognized serializer: '%s'. Returning json serializer", serializer)
 
</s> remove     elif serializer.lower() == "yaml" and yaml is not None:
 </s> add     elif serializer.lower() == "yaml" and _HAS_YAML: </s> remove     elif extension in (".yaml", ".yml") and yaml is None:
 </s> add     elif extension in (".yaml", ".yml"): </s> remove     elif extension in (".yaml", ".yml") and yaml is not None:
 </s> add     elif extension in (".yaml", ".yml") and _HAS_YAML: </s> remove         retval = dict()
 </s> add         retval = {} </s> remove             msg = "Error reading from '{}': {}".format(filename, err.strerror)
 </s> add             msg = f"Error reading from '{filename}': {err.strerror}"
    elif serializer.lower() == "yaml":
      elif serializer.lower() == "pickle":
          retval = _PickleSerializer()
      elif serializer.lower() == "yaml" and yaml is not None:
          retval = _YAMLSerializer()
    elif serializer.lower() == "yaml":
          logger.warning("You must have PyYAML installed to use YAML as the serializer."
                         "Switching to JSON as the serializer.")
          retval = _JSONSerializer
      else:
          logger.warning("Unrecognized serializer: '%s'. Returning json serializer", serializer)
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