Returns the code to check for actual values when an out parameter is pure 
    out/optional and doesn't have anything changed.

    :arg assign: the actual variable assignment value if the conditions pass.

def _py_check_optional(parameter, tab, assign):
    """Returns the code to check for actual values when an out parameter is pure 
    out/optional and doesn't have anything changed.

    :arg assign: the actual variable assignment value if the conditions pass.
    """
    if parameter.direction == "(out)":
        result = []
        checks = ["{0}_{1:d}.value==0".format(parameter.lname, i) for i in range(parameter.D)]
        spacing = len(tab) + 2 + 3 + 3 + 2
        result.append("{}if not all([{}]):".format(tab, present_params(checks, spacing, linecont=", ")))
        for line in assign:
            if assign is not None:
                result.append("{0}{1}".format(tab, line))
        result.append("{}else:".format(tab))
        result.append('{0}{0}result.add("{1}", None)'.format(tab, parameter.lname))
        return '\n'.join(result)
    else:
        return '\n'.join(assign)