It is impossible to determine the state of GPIO on most Pi (except by measurement).
It is possible with the BCM2711 used by Pi4 and I have written a Python3 library (based on RPi.GPIO) which does this and a program gpioread which shows this and the actual programmed function/state.
See https://raspberrypi.stackexchange.com/a/117593/8697
NOTE you can also get pull using the raspi-gpio utility.