title: itertools.islice is not a generator?
body: <p>I have a code piece that works on generators and generator functions. When I try to slice the generators with <code>itertools.islice</code>, the code piece generates no outputs.</p>
  
  <p>I've looked into the code, and found out the following code piece:</p>
  
  <pre><code>if isinstance(result, dict):
      self.returned(result)
  elif inspect.isgenerator(result):
      for x in result:
          self.returned(x)
  else:
      self.returned(result)
  </code></pre>
  
  <p>It turns out that <code>inspect.isgenerator</code> returns <code>False</code> for <code>itertools.islice</code>, which is what breaks the code. <code>inspect.isgeneratorfunction</code> behaves the same.</p>
  
  <ol>
  <li>Isn't <code>itertools.islice</code> a generator, or an generator function?</li>
  <li>How can I find out of <code>result</code> is a generator OR an <code>itertools.islice</code> object?</li>
  </ol>