type(), isinstance() для получения и определения типа в Python https://ru.from-locals.com/python-type-isinstance/