def METHOD_NAME(f, mtxmspecs, mtxm_gen, complex_a=False, complex_b=False, bg=True):
    r = lambda x: x
    if bg:
        r = lambda x: x.replace("double complex", "__complex__ double").replace("cabs", "abs")
    complex_c = (complex_a or complex_b) and "complex" or ""
    complex_a = complex_a and "complex" or ""
    complex_b = complex_b and "complex" or ""
    print(r(_header(bg, complex_c, complex_a, complex_b)), file=f)
    for mtxm in mtxmspecs:
        mtxm_gen(f, *mtxm)
    mtxms = [x[-1] for x in mtxmspecs]
    print(r(_timer(mtxms, complex_c, complex_a, complex_b)), file=f)
    if not (bool(complex_a) ^ bool(complex_b)):
        print(r(_transtimer(mtxms, complex_c, complex_a, complex_b)), file=f)
    print(r(_main(mtxms, complex_c, complex_a, complex_b)), file=f)