Python detecting character types module