<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _py_indices(parameter, lparams, tab):
 """Returns the code to produce py ctypes for the indices of the specified parameter that has D > 0. """

    if parameter.D > 0 and ":" in parameter.dimension:
        if "in" in parameter.direction:
            indexstr = "{0}_{1:d} = c_int({0}_a.shape[{1:d}])"
        else:
            indexstr = "{0}_{1:d} = c_int(0)"
        lparams.extend(["byref({}_{})".format(parameter.lname, i) for i in range(parameter.D)])
        joinstr = "\n" + tab
        blank = True if parameter.direction == "(out)" else False
        return (joinstr.join([indexstr.format(parameter.lname, i)
                              for i in range(parameter.D)]), blank)