code: def set_all(self, path, body):
          "Replaces the hosts list with the provided input"
          # Do some error checking
          if not isinstance(body, dict):
              raise HttpBadRequest("body_not_a_dict")
          for hostname, details in body.items():
              error = self.host_errors(hostname, details)
              if error:
                  raise HttpBadRequest("%s:%s" % (hostname, error))
          # Replace
          old_hostnames = set(self.balancer.hosts.keys())
          new_hostnames = set(body.keys())
          self.balancer.hosts = body
          # Clean up stats dict
          for hostname in new_hostnames - old_hostnames:
              self.balancer.stats[hostname] = {}
          for hostname in old_hostnames - new_hostnames:
              try:
                  del self.balancer.stats[hostname]
              except KeyError:
                  pass
          return {"ok": Truef set_all(self, path, body):
          "Replaces the hosts list with the provided input"
          # Do some error checking
          if not isinstance(body, dict):
              raise HttpBadRequest("body_not_a_dict")
          for hostname, details in body.items():
              error = self.host_errors(hostname, details)
              if error:
                  raise HttpBadRequest("%s:%s" % (hostname, error))
          # Replace
          old_hostnames = set(self.balancer.hosts.keys())
          new_hostnames = set(body.keys())
          self.balancer.hosts = body
          # Clean up stats dict
          for hostname in new_hostnames - old_hostnames:
              self.balancer.stats[hostname] = {}
          for hostname in old_hostnames - new_hostnames:
              try:
                  del self.balancer.stats[hostname]
              except KeyError:
                  pass
          return {"ok": True}
docs: Replaces the hosts list with the provided input