docs: def save(self, modelfile, layer=None):
          """
          Save a model file.
  
          :param modelfile: The name of the json file to save.
          :type modelfile: str
          :param layer: Optionally save only specified layer.
          :type layer: str
          """
          if layer:
              obj = {layer: self.model[layer]}
          else:
              obj = self.model
          with open(modelfile, 'w') as fp:
              json.dump(obj, fp, indent=2, sort_keys=True)