code: def get_nodes(self, states=None):
          
          if states is not None:
              states = tuple(NodeState(s) for s in states)
          else:
              states = ()
  
          req = proto.NodesRequest(states=[str(s) for s in states])
          resp = self._call('getNodes', req)
          return sorted((NodeReport.from_protobuf(r) for r in resp.reports),
                        key=lambda x: x.id)
docs: Get the status of nodes in the cluster.
  
          Parameters
          ----------
          states : sequence of NodeState, optional
              If provided, nodes will be filtered to these node states. Default
              is all states.
  
          Returns
          -------
          reports : list of NodeReport
  
          Examples
          --------
          Get all the running nodes
  
          >>> client.get_nodes(states=['RUNNING'])
          [NodeReport<id='worker1.example.com:34721'>,
           NodeReport<id='worker2.example.com:34721'>]