What is the proper python way to write methods that only take a particular type?
<p>I have a function that is supposed to take a string, append things to it where necessary, and return the result. </p>

<p>My natural inclination is to just return the result, which involved string concatenation, and if it failed, let the exception float up to the caller. However, this function has a default value, which I just return unmodified. </p>

<p>My question is: What if someone passed something unexpected to the method, and it returns something the user doesn't expect? The method should fail, but how to enforce that? </p>
