<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_ftype(parameter, tab):
 """Returns the code to declare an Ftype object that handles memory deallocation for Fortran return arrays that were allocated by the method called in ctypes. """

    splice = ', '.join(["{0}_{1:d}".format(parameter.lname, i)
                        for i in range(parameter.D)])       
    return "{2}{0}_ft = Ftype({0}_o, [{1}], libpath)".format(parameter.lname, splice, tab)