def METHOD_NAME(self, platform):
    if self.i is None:
        pin = Pin(len(self.target), dir="oe")
        pin.o = self.o
        pin.oe = self.oe
        return platform.get_tristate(pin, self.target, attrs={}, invert=None)
    else:
        pin = Pin(len(self.target), dir="io")
        pin.o = self.o
        pin.oe = self.oe
        pin.i = self.i
        return platform.get_input_output(pin, self.target, attrs={}, invert=None)
    m = Module()
    if self.i is not None:
        m.d.comb += self.i.eq(self.target)
    m.submodules += Instance("$tribuf",
        p_WIDTH=len(self.target),
        i_EN=self.oe,
        i_A=self.o,
        o_Y=self.target,
    )
    f = m.METHOD_NAME(platform)
    f.flatten = True
    return f