How to create a list containing lists of bm.verts based on their deform layer (vertex group)? I have been struggling with trying to find a way to do this. It's related to my previous efforts here:
How to get list of bm.verts that belong to a deform layer?
When I do this

for vert in bm.verts:
        dvert = vert[layer_deform]


I get a dictionary of deform layer numbers (keys) and weights (values) per bm.vert. What I'd like to achieve is a list containing lists of verts, based on their deform layer (vertex group) number. So it should look something like this:

vertex_lists = [[&lt;BMVert(0x000002A7818090B0), index=12&gt;, &lt;BMVert(0x000002A7818090E8), index=13&gt;], [&lt;BMVert(0x000002A7818090B0), index=15&gt;, &lt;BMVert(0x000002A7818090E8), index=20&gt;], [&lt;BMVert(0x000002A7818090B0), index=44&gt;, &lt;BMVert(0x000002A7818090E8), index=24&gt;]]


I'd like to achieve this in order to automate further bmesh.ops. I am guessing I need to find a way to iterate over bm.verts and append them to a list based on their layer deform key (vertex group number). How do I group the verts into separate lists based on their respective layer_deform numbers?
Code below creates a dictionary of vertex, weight pairs for each vg.  The defaultdict is great for this, as can set the default item to an empty list and append directly on key (in this case vg name)

import bpy
import bmesh
from collections import defaultdict
ob = bpy.context.edit_object
me = ob.data
names = tuple(vg.name for vg in ob.vertex_groups)
bm = bmesh.from_edit_mesh(me)
layer_deform = bm.verts.layers.deform.active
if layer_deform:
    vgs = defaultdict(list)
    for v in bm.verts:
        for vg_index, weight in v[layer_deform].items():
            name = names[vg_index]
            vgs[name].append((v, weight))

    for k, v in vgs.items():
        print(k, v)


sample output

Group [(&lt;BMVert(0x7f99f0325010), index=0&gt;, 1.0), (&lt;BMVert(0x7f99f0325048), index=1&gt;, 1.0), (&lt;BMVert(0x7f99f0325080), index=2&gt;, 1.0), (&lt;BMVert(0x7f99f03250b8), index=3&gt;, 1.0), (&lt;BMVert(0x7f99f03250f0), index=4&gt;, 1.0), (&lt;BMVert(0x7f99f0325128), index=5&gt;, 1.0), (&lt;BMVert(0x7f99f0325160), index=6&gt;, 1.0)]
Group.001 [(&lt;BMVert(0x7f99f03250f0), index=4&gt;, 1.0), (&lt;BMVert(0x7f99f0325160), index=6&gt;, 1.0)]
Group.002 [(&lt;BMVert(0x7f99f0325128), index=5&gt;, 1.0), (&lt;BMVert(0x7f99f0325198), index=7&gt;, 0.4263862371444702)]


can access with 

for v, w in vgs[vg.name]:
    print("vertex", v.index, "has weight", w)


for a list of lists as requested in question, define array for length of vgs

vgs = [[]] * len(ob.vertex_groups) # create a list for each vg


then populate with

for vg_index in v[layer_deform].keys():
    vgs[vg_index].append(v)


Related: Accessing weights of a bmesh