Rotate bmesh around Vector with Python
Rotate bmesh vertices around a vector defined by two selected verts. 

Test script, rotates 45 degrees around the vector defined by two selected verts.  Select two vertices and run script. Running 8 times should rotate the full sweep.  

import bpy
import bmesh
context = bpy.context
from mathutils import Matrix
from math import radians

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

# have 2 verts selected.
v1, v2, *_ = (v for v in bm.verts if v.select)
axis = (v2.co - v1.co).normalized()
rot = Matrix.Rotation(radians(45), 4, axis)
bmesh.ops.rotate(bm, cent=v2.co, matrix=rot, verts=bm.verts)

me.update()


Note: because our rotation matrix is using an axis and both v1 and v2 are on the axis,  either (or any point on) can be used for cent property of operator .  The centre point would be calculated via v1.co + axis / 2 or (v1.co + v2.co) / 2