          logger.debug("Getting serializer: (filename: '%s', serializer: '%s')",
                       filename, serializer)
          extension = os.path.splitext(filename)[1]
          if extension in (".json", ".p", ".yaml", ".yml"):
              logger.debug("Serializer set from file extension: '%s'", extension)
              retval = Serializer.get_serializer_from_ext(extension)
          elif serializer not in ("json", "pickle", "yaml"):
              raise ValueError("Error: {} is not a valid serializer. Use "
                               "'json', 'pickle' or 'yaml'")
          else:
              logger.debug("Serializer set from argument: '%s'", serializer)
 
</s> remove             retval = Serializer.get_serializer(serializer)
        logger.verbose("Using '%s' serializer for alignments", retval.ext)
 </s> add             retval = get_serializer(serializer)
        logger.verbose("Using '%s' serializer for alignments", retval.file_extension) </s> remove                                                    self.serializer.ext))
            logger.debug("File extension set from serializer: '%s'", self.serializer.ext)
 </s> add                                                    self.serializer.file_extension))
            logger.debug("File extension set from serializer: '%s'",
                         self.serializer.file_extension) </s> remove         with open(statefile, "rb") as inp:
            state = self.serializer.unmarshal(inp.read().decode("utf-8"))
            trainer = state.get("name", None)
 </s> add         state = self.serializer.load(statefile)
        trainer = state.get("name", None) </s> remove             with open(recent_filename, "rb") as inp:
                recent_files = self.serializer.unmarshal(inp.read().decode("utf-8"))
 </s> add             recent_files = self.serializer.load(recent_filename) </s> remove         try:
            logger.info("Reading alignments from: '%s'", self.file)
            with open(self.file, self.serializer.roptions) as align:
                data = self.serializer.unmarshal(align.read())
        except IOError as err:
            logger.error("'%s' not read: %s", self.file, err.strerror)
            exit(1)
 </s> add         logger.info("Reading alignments from: '%s'", self.file)
        data = self.serializer.load(self.file)
            logger.debug("Serializer set from filename extension: '%s'", extension)
            retval = get_serializer_from_filename(filename)
          logger.debug("Getting serializer: (filename: '%s', serializer: '%s')",
                       filename, serializer)
          extension = os.path.splitext(filename)[1]
          if extension in (".json", ".p", ".yaml", ".yml"):
            logger.debug("Serializer set from filename extension: '%s'", extension)
            retval = get_serializer_from_filename(filename)
            logger.debug("Serializer set from filename extension: '%s'", extension)
            retval = get_serializer_from_filename(filename)
          elif serializer not in ("json", "pickle", "yaml"):
              raise ValueError("Error: {} is not a valid serializer. Use "
                               "'json', 'pickle' or 'yaml'")
          else:
              logger.debug("Serializer set from argument: '%s'", serializer)
keep keep keep keep replace replace keep keep keep keep keep
 Standardize serialization (#903)

* Standardize serialization

- Linting
- Standardize serializer use throughout code
- Extend serializer to load and save files
- Always load and save in utf-8
- Create documentation 
lib/alignments.py