code: def load(self):
          "Loads the state from the state file"
          try:
              if os.path.getsize(self.state_file) <= 1:
                  raise IOError("File is empty.")
              with open(self.state_file) as fh:
                  state = json.load(fh)
                  assert isinstance(state, dict)
                  self.hosts = state['hosts']
                  self.stats = state['stats']
              for key in self.stats:
                  self.stats[key]['open_requests'] = 0
          except (IOError, OSError):
              # There is no state file; start empty.
              self.hosts = {}
              self.stats = {f load(self):
          "Loads the state from the state file"
          try:
              if os.path.getsize(self.state_file) <= 1:
                  raise IOError("File is empty.")
              with open(self.state_file) as fh:
                  state = json.load(fh)
                  assert isinstance(state, dict)
                  self.hosts = state['hosts']
                  self.stats = state['stats']
              for key in self.stats:
                  self.stats[key]['open_requests'] = 0
          except (IOError, OSError):
              # There is no state file; start empty.
              self.hosts = {}
              self.stats = {}
docs: Loads the state from the state file