How could I do it without using those standard library functions? e.g. isinstance(), etc