def is_mongo_running():
 output = os.popen('mongo --eval "print(\'running\')"').read()
 return (output and ('running' in output))

def is_mongo_running ( ) : output = os . popen ( 'mongo --eval "print(\'running\')"' ) . read ( ) return ( output and ( 'running' in output ) )
returns true if mongo is running .