code: def write_all(self, path):
          
          all_search_methods = [(name, self.__getattribute__(name)) for name in
                                dir(self) if name[0].isupper()]
          # all_search_methods = [("Account", self.__getattribute__("Account")), ("Package", self.__getattribute__("Package"))]
          all_objects = {}
          for method in all_search_methods:
              result = method[1]()
              if isinstance(result, JSSFlatObject):
                  all_objects[method[0]] = result
              else:
                  try:
                      all_objects[method[0]] = result.retrieve_all()
                  except JSSGetError:
                      # A failure to get means the object type has zero
                      # results.
                      print method[0], " has no results! (GETERRROR)"
                      all_objects[method[0]] = []
          # all_objects = {method[0]: method[1]().retrieve_all()
          #                for method in all_search_methods}
          with open(os.path.expanduser(path), "w") as ofile:
              root = ElementTree.Element("JSS")
              for obj_type, objects in all_objects.items():
                  if objects is not None:
                      sub_element = ElementTree.SubElement(root, obj_type)
                      sub_element.extend(objects)
  
              et = ElementTree.ElementTree(root)
              et.write(ofile, encoding="utf-8")
docs: Back up entire JSS to XML file.
  
          For each object type, retrieve all objects, and then pickle
          the entire smorgasbord. This will almost certainly take a long
          time!
  
          Pickling is Python's method for serializing/deserializing
          Python objects. This allows you to save a fully functional
          JSSObject to disk, and then load it later, without having to
          retrieve it from the JSS.
  
          Args:
              path: String file path to the file you wish to (over)write.
                  Path will have ~ expanded prior to opening.