def _py_code_parameter(lines, parameter, position, lparams, tab):
    """Appends the code to produce the parameter at the specified position in the executable.

    :arg position: one of ['invar', 'outvar', 'indices'].
    :arg lparams: a list of the local variable declarations made so far that need to be passed
      to the executable when it is called.
    """
    mdict = {
        "invar": _py_invar,
        "outvar": _py_outvar,
        "indices": _py_indices
    }
    line = mdict[position](parameter, lparams, tab)
    if line is not None:
        value, blank = line
        lines.append(tab + value)
        if blank:
            lines.append("")