def nodes(self, unreported=<NUM_LIT:2>, with_status=False, **kwargs):
nodes = self._query('<STR_LIT>', **kwargs)<EOL>now = datetime.datetime.utcnow()<EOL>if type(nodes) == dict:<EOL><INDENT>nodes = [nodes, ]<EOL><DEDENT>if with_status:<EOL><INDENT>latest_events = self.event_counts(<EOL>query=EqualsOperator("<STR_LIT>", True),<EOL>summarize_by='<STR_LIT>'<EOL>)<EOL><DEDENT>for node in nodes:<EOL><INDENT>node['<STR_LIT>'] = None<EOL>node['<STR_LIT>'] = None<EOL>if with_status:<EOL><INDENT>status = [s for s in latest_events<EOL>if s['<STR_LIT>']['<STR_LIT:title>'] == node['<STR_LIT>']]<EOL>try:<EOL><INDENT>node['<STR_LIT>'] = node['<STR_LIT>']<EOL>if status:<EOL><INDENT>node['<STR_LIT>'] = status[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>except KeyError:<EOL><INDENT>if status:<EOL><INDENT>node['<STR_LIT>'] = status = status[<NUM_LIT:0>]<EOL>if status['<STR_LIT>'] > <NUM_LIT:0>:<EOL><INDENT>node['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>if status['<STR_LIT>'] > <NUM_LIT:0>:<EOL><INDENT>node['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>if status['<STR_LIT>'] > <NUM_LIT:0>:<EOL><INDENT>node['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT><DEDENT>else:<EOL><INDENT>node['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT><DEDENT>if node['<STR_LIT>'] is not None:<EOL><INDENT>try:<EOL><INDENT>last_report = json_to_datetime(<EOL>node['<STR_LIT>'])<EOL>last_report = last_report.replace(tzinfo=None)<EOL>unreported_border = now - timedelta(hours=unreported)<EOL>if last_report < unreported_border:<EOL><INDENT>delta = (now - last_report)<EOL>node['<STR_LIT>'] = True<EOL>node['<STR_LIT>'] = '<STR_LIT>'.format(<EOL>delta.days,<EOL>int(delta.seconds / <NUM_LIT>),<EOL>int((delta.seconds % <NUM_LIT>) / <NUM_LIT>)<EOL>)<EOL><DEDENT><DEDENT>except AttributeError:<EOL><INDENT>node['<STR_LIT>'] = True<EOL><DEDENT><DEDENT>if not node['<STR_LIT>']:<EOL><INDENT>node['<STR_LIT>'] = True<EOL><DEDENT><DEDENT>yield Node(self,<EOL>name=node['<STR_LIT>'],<EOL>deactivated=node['<STR_LIT>'],<EOL>expired=node['<STR_LIT>'],<EOL>report_timestamp=node['<STR_LIT>'],<EOL>catalog_timestamp=node['<STR_LIT>'],<EOL>facts_timestamp=node['<STR_LIT>'],<EOL>status_report=node['<STR_LIT>'],<EOL>noop=node.get('<STR_LIT>'),<EOL>noop_pending=node.get('<STR_LIT>'),<EOL>events=node['<STR_LIT>'],<EOL>unreported=node.get('<STR_LIT>'),<EOL>unreported_time=node.get('<STR_LIT>'),<EOL>report_environment=node['<STR_LIT>'],<EOL>catalog_environment=node['<STR_LIT>'],<EOL>facts_environment=node['<STR_LIT>'],<EOL>latest_report_hash=node.get('<STR_LIT>'),<EOL>cached_catalog_status=node.get('<STR_LIT>')<EOL>)<EOL><DEDENT>
Query for nodes by either name or query. If both aren't
        provided this will return a list of all nodes. This method
        also fetches the nodes status and event counts of the latest
        report from puppetdb.

        :param with_status: (optional) include the node status in the\
                           returned nodes
        :type with_status: :bool:
        :param unreported: (optional) amount of hours when a node gets
                           marked as unreported
        :type unreported: :obj:`None` or integer
        :param \*\*kwargs: The rest of the keyword arguments are passed
                           to the _query function

        :returns: A generator yieling Nodes.
        :rtype: :class:`pypuppetdb.types.Node`