<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def printDuplicatedTPEDandTFAM(tped, tfamFileName, outPrefix):
 """Print the duplicated SNPs TPED and TFAM. :param tped: a representation of the ``tped`` of duplicated markers. :param tfamFileName: the name of the original ``tfam`` file. :param outPrefix: the output prefix. :type tped: numpy.array :type tfamFileName: str :type outPrefix: str First, it copies the original ``tfam`` into ``outPrefix.duplicated_snps.tfam``. Then, it prints the ``tped`` of duplicated markers in ``outPrefix.duplicated_snps.tped``. """

    # Copying the tfam file
    try:
        shutil.copy(tfamFileName, outPrefix + ".duplicated_snps.tfam")
    except IOError:
        msg = "%(tfamFileName)s: can't copy file to " \
              "%(outPrefix)s.duplicated_snps.tfam" % locals()
        raise ProgramError(msg)

    # Writing the tped
    tpedFile = None
    try:
        tpedFile = open(outPrefix + ".duplicated_snps.tped", "w")
    except IOError:
        msg = "%(outPrefix)s.duplicated_snps.tped: can't write " \
              "file" % locals()
        raise ProgramError(msg)
    for row in tped:
        print >>tpedFile, "\t".join(row)
    tpedFile.close()