@classmethod
  def from_node(cls, member, data):
    blob = json.loads(data)
    additional_endpoints = blob.get('additionalEndpoints')
    if additional_endpoints is None:
      raise ValueError("Expected additionalEndpoints in member data")
    service_endpoint = blob.get('serviceEndpoint')
    if service_endpoint is None:
      raise ValueError("Expected serviceEndpoint in member data")
    status = blob.get('status')
    if status is None:
      raise ValueError("Expected status in member data")

    shard = blob.get('shard')
    if shard is not None:
      try:
        shard = int(shard)
      except __HOLE__:
        ROOT_LOG.warn('Unable to parse shard from %r' % shard)
        shard = None

    return cls(
      member=member,
      service_endpoint=Endpoint(service_endpoint['host'], service_endpoint['port']),
      additional_endpoints=dict((name, Endpoint(value['host'], value['port']))
                                for name, value in additional_endpoints.items()),
      shard=shard,
      status=status
    )
dataset/ETHPy150Open steveniemitz/scales/scales/loadbalancer/zookeeper.py/Member.from_node