You may use the python apt module, but it only checks if the package is installed. It will fail non-deb distributions or if installed outside the package manager:
import apt
cache = apt.Cache()
cache.open()
cache["git-core"].is_installed# Evaluates true if git is installed
Try to run git and handle the exception if it fails:
import subprocess
try:
# pipe output to /dev/null for silence
null = open("/dev/null", "w")
subprocess.Popen("git", stdout=null, stderr=null)
null.close()
except OSError:
print("git not found")
A third option would be to try all the paths in $PATH
and test if you have exec permission on path/git.