Check if an app is installed on the device
This did the trick guys. 

pathCmd = './adb shell pm path ' + packageName
result = os.popen(pathCmd).read()
if result:
    print "App found on the device"
else:
    print "App not found on the device"


This give system output as string and looks for string length to confirm the presence of an app in the device. Its usually an empty string that is received for a package name that doesn't exist in the device.