its better to use `isinstance` here. see http://docs.python.org/2/library/functions.html#type