<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def printStatistics(completion, concordance, tpedSamples, oldSamples, prefix):
 """Print the statistics in a file. :param completion: the completion of each duplicated samples. :param concordance: the concordance of each duplicated samples. :param tpedSamples: the updated position of the samples in the tped containing only duplicated samples. :param oldSamples: the original duplicated sample positions. :param prefix: the prefix of all the files. :type completion: :py:class:`numpy.array` :type concordance: dict :type tpedSamples: dict :type oldSamples: dict :type prefix: str :returns: the completion for each duplicated samples, as a :py:class:`numpy.array`. Prints the statistics (completion of each samples and pairwise concordance between duplicated samples) in a file (``prefix.summary``). """


    # Compute the completion percentage on none zero values
    none_zero_indexes = np.where(completion[1] != 0)
    completionPercentage = np.zeros(len(completion[0]), dtype=float)
    completionPercentage[none_zero_indexes] = np.true_divide(
        completion[0, none_zero_indexes],
        completion[1, none_zero_indexes],
    )

    # The output file containing the summary statistics (for each of the
    # duplicated samples, print the mean concordance and the completion).
    outputFile = None
    try:
        outputFile = open(prefix + ".summary", "w")
    except IOError:
        msg = "%(prefix)s.summary: can't write file" % locals()
        raise ProgramError(msg)

    print >>outputFile, "\t".join(["origIndex", "dupIndex", "famID", "indID",
                                   "% completion", "completion",
                                   "mean concordance"])
    for sampleID, indexes in tpedSamples.iteritems():
        for i, index in enumerate(indexes):
            # The indexes
            toPrint = [str(oldSamples[sampleID][i]+1), str(index+1)]
            # The samples
            toPrint.extend(list(sampleID))

            # The completion
            toPrint.append("%.8f" % completionPercentage[index])
            toPrint.append("%d/%d" % (completion[0][index],
                                      completion[1][index]))

            # The concordance (not on total values = 0)
            indexToKeep = list(set(range(len(indexes))) - set([i]))
            values = np.ravel(
                np.asarray(concordance[sampleID][0][i, indexToKeep])
            )
            total_values = np.ravel(
                np.asarray(concordance[sampleID][1][i, indexToKeep])
            )
            currConcordance = np.zeros(len(indexToKeep), dtype=float)
            none_zero_indexes = np.where(total_values != 0)
            currConcordance[none_zero_indexes] = np.true_divide(
                values[none_zero_indexes],
                total_values[none_zero_indexes],
            )
            currConcordance = np.mean(currConcordance)
            toPrint.append("%.8f" % currConcordance)
            print >>outputFile, "\t".join(toPrint)

    # Closing the output file
    outputFile.close()

    return completionPercentage