def METHOD_NAME(self) -> Union[str, dict]:
    # Load the path into contents unless it already exists
    self._load_contents()
    # Run all the modifiers
    self._modify_dicts()
    if self.write:
        mode = self.mode or 'w'
        with open(self.path, mode) as f:
            yaml.dump(self.contents, f)
            return self.contents
    else:
        # Read operation, just return contents
        return self.contents