def METHOD_NAME(self, buff):
    # do we need units code?
    if self.params['units'].val == 'from exp settings':
        unitsStr = ""
    else:
        unitsStr = "units=%(units)s, " % self.params
    # replace variable params with defaults
    inits = getInitVals(self.params, 'PsychoPy')
    code = ("{inits[name]} = visual.ImageStim(\n"
            "    win=win,\n"
            "    name='{inits[name]}', {units}\n"
            "    image={inits[image]}, mask={inits[mask]}, anchor={inits[anchor]},\n"
            "    ori={inits[ori]}, pos={inits[pos]}, size={inits[size]},\n"
            "    color={inits[color]}, colorSpace={inits[colorSpace]}, opacity={inits[opacity]},\n"
            "    flipHoriz={inits[flipHoriz]}, flipVert={inits[flipVert]},\n"
            # no newline - start optional parameters
            "    texRes={inits[texture resolution]}"
            .format(inits=inits,
                    units=unitsStr))
    if self.params['interpolate'].val == 'linear':
        code += ", interpolate=True"
    else:
        code += ", interpolate=False"
    depth = -self.getPosInRoutine()
    code += ", depth=%.1f)\n" % depth
    buff.writeIndentedLines(code)