Python – Possible improvements for data transformation with dictionaries and lists

My initial problem is one list from mappings are their values lists of values. The converted list must contain the Cartesian product of all lists (those that are values ​​in the dictionaries) that belong to separate dictionaries (in other words, the values ​​of the lists in the same directories are "coupled").

If you ignore the keywords in the dictionaries, this is easily solved itertools.product,

Entrance:

[
   {
      ('B3G', 'B1'): [1.0, 2.0],
("B1G", "B1"): [11.0, 12.0]
   },
{
("B2G", "B1"): [1.5, 2.5, 3.5]
   }
]

Output:

[
  {('B3G', 'B1'): 1.0, ('B1G', 'B1'): 11.0, ('B2G', 'B1'): 1.5},
  {('B3G', 'B1'): 1.0, ('B1G', 'B1'): 11.0, ('B2G', 'B1'): 2.5},
  {('B3G', 'B1'): 1.0, ('B1G', 'B1'): 11.0, ('B2G', 'B1'): 3.5},
  {('B3G', 'B1'): 2.0, ('B1G', 'B1'): 12.0, ('B2G', 'B1'): 1.5},
  {('B3G', 'B1'): 2.0, ('B1G', 'B1'): 12.0, ('B2G', 'B1'): 2.5},
  {('B3G', 'B1'): 2.0, ('B1G', 'B1'): 12.0, ('B2G', 'B1'): 3.5}
]

To make things even more confusing, the keywords are the individual dictionaries tuples of strings.

Here is one possible implementation with one class isolate the whole mess.

@dataclass
Class ParametricMapping:
"" Abstraction for multidimensional parametric mappings. " ""

Assignments: List[Mapping[Tuple[str], Sequence[float]]]= Field (default_factory = lambda: [{}])

@Property
def combinations (self) -> list[Mapping[Tuple[str]swim]]:
"" "Cartesian product suitable for working with dictionaries, much like 'itertools.product`." ""

labels = [label for arg in self.mappings for label in tuple(arg.keys())]
    Pools = [list(map(tuple, zip(*arg.values()))) for arg in self.mappings]

    def cartesian_product (* args):
"" "Cartesian product similar to" itertools.product "" ""
Result = [[]]for pool in args:
Result = [x + [y] for x as a result for y in the pool]Return result

Results []
    for term in cartesian_product (* Pools):
results.append ([pp for p in term for pp in p])

tmp = []
    for r in results:
tmp.append ({k: v for k, v in zip (labels, r)})

if len (tmp) == 0:
return [{}]
    otherwise:
Return tmp

question: How can I improve that to make it cleaner (priority # 1) and faster (# 2).