So, others have answered with ways to generally catch exceptions. I'm going to take a slightly different bent. I think what you're asking about is how you can achieve the same sort of type safety that occurs in a statically typed language.
First off, you probably don't want to. One of python's advantages is duck typing. From Wikipedia:
duck typing is a style of dynamic typing in which an object's current set of methods and properties determines the valid semantics, rather than its inheritance from a particular class or implementation of a specific interface
The advantage of duck typing is that you don't have to do type checking, you can pass any object that has a given method.
However, you then have the problem: "How does one consistently check that my code will be correct without running it?" This is especially annoying when an error only occurs as an edge case. One good way to insure consistent behavior, even while changing your code base, is to write unit tests. Python has a number of different methods of implementing unit testing. The simplest is probably the doctest module. If you want something more powerful, however, there's also unittest, and the unittest compatible third-party framework nose.
The benefit of unit testing is that you can write them as you go, making sure to look for even the uncommon edge cases, and then run them any time you make a significant change to your program. Then, if the tests fail, you know you've broken something.