If t is of type long, return it, otherwise raise InvalidTypeError.

def getLong(t):
    """If t is of type long, return it, otherwise raise InvalidTypeError.
    """
    i = c_long()
    if PL_get_long(t, byref(i)):
        return i.value
    else:
        raise InvalidTypeError("long")