title: Optimization: Python String Repetition
body: <p>I have a piece of code that will take a string and repeat it such that the length of the string is x.</p>
  
  <pre><code>&gt;&gt;&gt; import math
  &gt;&gt;&gt; def repeat(data, length):
          return (data * int(math.ceil(float(length) / len(data))))[:length]
  &gt;&gt;&gt; repeat("Hello World", 22)
  'Hello WorldHello World'
  &gt;&gt;&gt; repeat("Hello World", 20)
  'Hello WorldHello Wor'
  </code></pre>
  
  <p>Is there any way to optimize it?
  I need this operation to be fast, as it will be used a lot.
  Note that this also needs to work with lists.</p>