code: def dump(self, filename=None, compressed=True, pretty=True):
          '''dump device window and pull to local file.'''
          content = self.server.jsonrpc.dumpWindowHierarchy(compressed, None)
          if filename:
              with open(filename, "wb") as f:
                  f.write(content.encode("utf-8"))
          if pretty and "\n " not in content:
              xml_text = xml.dom.minidom.parseString(content.encode("utf-8"))
              content = U(xml_text.toprettyxml(indent='  '))
          return contenf dump(self, filename=None, compressed=True, pretty=True):
          '''dump device window and pull to local file.'''
          content = self.server.jsonrpc.dumpWindowHierarchy(compressed, None)
          if filename:
              with open(filename, "wb") as f:
                  f.write(content.encode("utf-8"))
          if pretty and "\n " not in content:
              xml_text = xml.dom.minidom.parseString(content.encode("utf-8"))
              content = U(xml_text.toprettyxml(indent='  '))
          return content
docs: dump device window and pull to local file.