code: def get_nodes(network_id, template_id=None, **kwargs):
      
      user_id = kwargs.get('user_id')
      try:
          net_i = db.DBSession.query(Network).filter(Network.id == network_id).one()
          net_i.check_read_permission(user_id=user_id)
      except NoResultFound:
          raise ResourceNotFoundError("Network %s not found"%(network_id))
  
      node_qry = db.DBSession.query(Node).filter(
                          Node.network_id==network_id,
                          Node.status=='A').options(
                              noload('network')
                          ).options(
                              joinedload_all('types.templatetype')
                          ).options(
                              joinedload_all('attributes.attr')
                          )
      if template_id is not None:
          node_qry = node_qry.filter(ResourceType.node_id==Node.id,
                                     TemplateType.id==ResourceType.type_id,
                                     TemplateType.template_id==template_id)
      nodes = node_qry.all()
  
      return nodes
docs: Get all the nodes in a network.
          args:
              network_id (int): The network in which to search
              template_id (int): Only return nodes whose type is in this template.