<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getAtomChars(t):
 """If t is an atom, return it as a string, otherwise raise InvalidTypeError. """

    s = c_char_p()
    if PL_get_atom_chars(t, byref(s)):
        return s.value
    else:
        raise InvalidTypeError("atom")