          print("Obtaining system information...")
          try:
              from lib.sysinfo import sysinfo
              info = sysinfo
          except Exception as err:
              info = "Error obtaining system info: {}".format(str(err))
          self.clear_console()
          logger.debug("Obtained system information: %s", info)
          print(info)
          self.root.config(cursor="")
 
</s> remove         try:
            with open(self.filename, "wb") as out:
                state = {"name": self.name,
                         "sessions": self.sessions,
                         "lowest_avg_loss": self.lowest_avg_loss,
                         "iterations": self.iterations,
                         "inputs": self.inputs,
                         "training_size": self.training_size,
                         "config": _CONFIG}
                state_json = self.serializer.marshal(state)
                out.write(state_json.encode("utf-8"))
        except IOError as err:
            logger.error("Unable to save model state: %s", str(err.strerror))
 </s> add         state = {"name": self.name,
                 "sessions": self.sessions,
                 "lowest_avg_loss": self.lowest_avg_loss,
                 "iterations": self.iterations,
                 "inputs": self.inputs,
                 "training_size": self.training_size,
                 "config": _CONFIG}
        self.serializer.save(self.filename, state) </s> remove         try:
            with open(self.filename, "rb") as inp:
                state = self.serializer.unmarshal(inp.read().decode("utf-8"))
                self.name = state.get("name", self.name)
                self.sessions = state.get("sessions", dict())
                self.lowest_avg_loss = state.get("lowest_avg_loss", dict())
                self.iterations = state.get("iterations", 0)
                self.training_size = state.get("training_size", 256)
                self.inputs = state.get("inputs", dict())
                self.config = state.get("config", dict())
                logger.debug("Loaded state: %s", state)
                self.replace_config(config_changeable_items)
        except IOError as err:
            logger.warning("No existing state file found. Generating.")
            logger.debug("IOError: %s", str(err))
        except JSONDecodeError as err:
            logger.debug("JSONDecodeError: %s:", str(err))
 </s> add         if not os.path.exists(self.filename):
            logger.info("No existing state file found. Generating.")
            return
        state = self.serializer.load(self.filename)
        self.name = state.get("name", self.name)
        self.sessions = state.get("sessions", dict())
        self.lowest_avg_loss = state.get("lowest_avg_loss", dict())
        self.iterations = state.get("iterations", 0)
        self.training_size = state.get("training_size", 256)
        self.inputs = state.get("inputs", dict())
        self.config = state.get("config", dict())
        logger.debug("Loaded state: %s", state)
        self.replace_config(config_changeable_items) </s> remove         try:
            with open(state_file, "rb") as inp:
                state = self.serializer.unmarshal(inp.read().decode("utf-8"))
                self.state = state
                logger.debug("Loaded state: %s", state)
        except IOError as err:
            logger.warning("Unable to load state file. Graphing disabled: %s", str(err))
 </s> add         self.state = self.serializer.load(state_file)
        logger.debug("Loaded state: %s", self.state) </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         try:
            with open(self.file, self.serializer.roptions) as align:
                data = self.serializer.unmarshal(align.read())
        except IOError as err:
            logger.error("Error: '%s' not read: %s", self.file, err.strerror)
            exit(1)
 </s> add         data = self.serializer.load(self.file)
        except Exception as err:  # pylint:disable=broad-except
          print("Obtaining system information...")
          try:
              from lib.sysinfo import sysinfo
              info = sysinfo
        except Exception as err:  # pylint:disable=broad-except
              info = "Error obtaining system info: {}".format(str(err))
          self.clear_console()
          logger.debug("Obtained system information: %s", info)
          print(info)
          self.root.config(cursor="")
keep keep keep keep 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/gui/menu.py