title: Python function for capping a string to a maximum length
body: <p>Is there a function in Python, built-in or in the standard library, for capping a string to a certain length, and if the length was exceeded, append three dots (...) after it?</p>
  
  <p>For example:</p>
  
  <pre>
  >>> hypothetical_cap_function("Hello, world! I'm a string", 10)
  "Hello, ..."
  >>> hypothetical_cap_function("Hello, world! I'm a string", 20)
  "Hello, world! I'm..."
  >>> hypothetical_cap_function("Hello, world! I'm a string", 50)
  "Hello, world! I'm a string"
  </pre>