title: python: repeating elements in a list based a predicateHow
body: <p>I'd like to repeat elements of a list based on a predicate.
  I tried using the module itertools and a list comprehension</p>
  
  <pre><code>abc = [1,2,3,4,5,6,7,8,9]
  result = [ repeat(item,2) if item==3 or item==7 else item for item in abc ]
  </code></pre>
  
  <p>This doesn't fail at runtime, but the resulting object is not 'flattened'
  If I print it, I see</p>
  
  <pre><code>[1, 2, repeat(3, 2), 4, 5, 6, repeat(7, 2), 8, 9]
  </code></pre>
  
  <p>Is it doable with a list comprehension?</p>
  
  <p>Thanks</p>