Creating pockets using bmesh/python
This seems to work, in edit mode (for the simplicity of example)

import bpy
import bmesh

obj = bpy.context.edit_object
me = obj.data
bm = bmesh.from_edit_mesh(me)

face = [bm.faces.active]

bmesh.ops.inset_region(bm, faces=face, thickness=0.4)
bmesh.ops.inset_region(bm, faces=face, thickness=0, depth=-0.5)

bmesh.update_edit_mesh(me, True)




Regarding bmesh.ops.scale(), it takes a space argument which is a matrix to base the operation on. If you are comfortable generating matrices then that's probably enough, but if not then see this snippet.

Template can be found at TextEditor->Templates->Python->Bmesh Simple

import bpy
import bmesh
from mathutils import Vector, Matrix

# Get the active mesh
me = bpy.context.object.data
bm = bmesh.new()   # create an empty BMesh
bm.from_mesh(me)   # fill it in from a Mesh

bm.edges.ensure_lookup_table()
bm.verts.ensure_lookup_table()

e = bm.edges[0]

mid_invert = (e.verts[0].co + e.verts[1].co) * -0.5
edge_matrix = Matrix()
edge_matrix[0][3] = mid_invert[0]
edge_matrix[1][3] = mid_invert[1]
edge_matrix[2][3] = mid_invert[2]

factor = (0.5, 0.5, 0.5)
bmesh.ops.scale(bm, vec=factor, space=edge_matrix, verts=e.verts)

# Finish up, write the bmesh back to the mesh
bm.to_mesh(me)
bm.free()  # free and prevent further access


I'm almost positive that there is an easier way to construct the space matrix, given a simple 3-vector, rather than my verbose approach.