code: def facts(self, name=None, value=None, **kwargs):
          
          if name is not None and value is not None:
              path = '{0}/{1}'.format(name, value)
          elif name is not None and value is None:
              path = name
          else:
              path = None
  
          facts = self._query('facts', path=path, **kwargs)
          for fact in facts:
              yield Fact(
                  node=fact['certname'],
                  name=fact['name'],
                  value=fact['value'],
                  environment=fact['environment']
              )
docs: Query for facts limited by either name, value and/or query.
  
          :param name: (Optional) Only return facts that match this name.
          :type name: :obj:`string`
          :param value: (Optional) Only return facts of `name` that\
              match this value. Use of this parameter requires the `name`\
              parameter be set.
          :type value: :obj:`string`
          :param \*\*kwargs: The rest of the keyword arguments are passed
              to the _query function
  
          :returns: A generator yielding Facts.
          :rtype: :class:`pypuppetdb.types.Fact`