def METHOD_NAME(env):
    if not (env.has_module(":board:nucleo-f*") or env.has_module(":board:al-avr*")):
        env.log.warn("GPIO test has been hardcoded to a Nucleo-64 board. "
                     "When porting make sure this test does not damage your board!")
        return
    device = env[":target"]
    identifier = device.identifier
    test_io = test_io_nucleo_64 if identifier["platform"] == "stm32" else test_io_al_avrev_can
    driver = device.get_driver("gpio")
    gpios = [g for g in driver["gpio"] if (g["port"].upper(), int(g["pin"])) in test_io]
    peripherals = sorted([get_driver(s) for g in gpios for s in (g["signal"] if "signal" in g else [])])
    connections = OrderedDict()
    for k in peripherals:
        rconns = [(g["port"].upper(), int(g["pin"]), get_name(s), get_af(s)) for g in gpios for s in (g["signal"] if "signal" in g else []) if get_driver(s) == k]
        # we need to remove duplicate GPIOs from this list
        # since we cannot set the same GPIO to multiple different AFs!
        conns = []
        for r in rconns:
            if any(r[0] == t[0] and r[1] == t[1] for t in conns):
                continue
            conns.append(r)
        connections[k] = conns
    properties = {
        "target": identifier,
        "test_io": test_io,
        "test_connections": connections
    }
    env.substitutions = properties
    env.outbasepath = "modm-test/src/modm-test/platform/gpio"
    env.copy("platform_gpio_test.hpp")
    env.template("platform_gpio_test_{}.cpp.in".format(identifier["platform"]))