              raise ValueError("Error: {} is not a valid serializer. Use "
                               "'json', 'pickle' or 'yaml'")
          else:
              logger.debug("Serializer set from argument: '%s'", serializer)
              retval = Serializer.get_serializer(serializer)
          logger.verbose("Using '%s' serializer for alignments", retval.ext)
          return retval
  
      def get_location(self, folder, filename):
          """ Return the path to alignments file """
          logger.debug("Getting location: (folder: '%s', filename: '%s')", folder, filename)
 
</s> remove             logger.debug("Serializer set from file extension: '%s'", extension)
            retval = Serializer.get_serializer_from_ext(extension)
 </s> add             logger.debug("Serializer set from filename extension: '%s'", extension)
            retval = get_serializer_from_filename(filename) </s> remove         self.add_to_recent(cfgfile.name, command)
        logger.debug("Loaded config: (command: '%s', cfgfile: '%s')", command, cfgfile)
 </s> add         self.add_to_recent(filename, command)
        logger.debug("Loaded config: (command: '%s', filename: '%s')", command, 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) </s> remove         self.add_to_recent(cfgfile.name, command)
        logger.debug("Saved config: (command: '%s', cfgfile: '%s')", command, cfgfile)
 </s> add         cfg = self.cli_opts.get_option_values(command)
        self.serializer.save(filename, cfg)
        self.add_to_recent(filename, command)
        logger.debug("Saved config: (command: '%s', filename: '%s')", command, filename) </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)
            retval = get_serializer(serializer)
        logger.verbose("Using '%s' serializer for alignments", retval.file_extension)
              raise ValueError("Error: {} is not a valid serializer. Use "
                               "'json', 'pickle' or 'yaml'")
          else:
              logger.debug("Serializer set from argument: '%s'", serializer)
            retval = get_serializer(serializer)
        logger.verbose("Using '%s' serializer for alignments", retval.file_extension)
            retval = get_serializer(serializer)
        logger.verbose("Using '%s' serializer for alignments", retval.file_extension)
          return retval
  
      def get_location(self, folder, filename):
          """ Return the path to alignments file """
          logger.debug("Getting location: (folder: '%s', filename: '%s')", folder, filename)
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