Call GPIO.gpio_function() on clean state, i.e. cleanup called or no RPI.GPIO pin assignments of any kind done, since as boot. For any given pin typically GPIO.IN is returned (excluding special use default mode pin assignments of course). However, this implies that GPIO.setup is not required if GPIO.IN is desired.
This is misleading, becaue given pin/channel can't actually be used. If read of pin is done, error results, RPi.GPIO reports that pin/channel must be setup before use! But it is setup, default setup is GPIO.IN. Documentation even states that all pins are set to GPIO.IN as default state when cleanup is called, or after boot (again special use pins withstanding). GPIO.gpio_function(pin) should return UNKNOWN if no assigment (i.e. setup has ever been done), after clean or since last boot. This would avoid any misleanding context.
Example, call initialize RPi.GPIO, set a pin to IN, call cleanup, then call gpio_function(pin), it will return 1, i.e. GP.IN, then do input operation on pin, and error stating GPIO pin has not been setup, i.e. "You must setup() the GPIO channel as an input first."