Measuing an irregular volume from an .stl mesh
The quick and dirty way would be this:


First use a remesh modifier with a fairly high number of iterations (at least 7), to keep a the fidelity high. The remesh modifier will automatically close off your mesh and make it watertight.
Use bmesh to calculate the volume:


import bpy, bmesh

o = bpy.context.object

bpy.ops.object.modifier_add( type = 'REMESH' )

remesh = o.modifiers[ len( o.modifiers ) - 1 ]
remesh.mode         = 'SMOOTH'   # Remesh type smooth
remesh.octree_depth = 7          # 7 subdivision levels

d   = o.to_mesh() # Create a temporary mesh with modifiers applied
bm  = bmesh.from_edit_mesh( d )
vol = bm.calc_volume()