Home Assistant is written in Python. Therefore, anything you do with connected devices or integrations will route back to the HA Python code.