<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def compareSNPs(before, after, outFileName):
 """Compares two set of SNPs. :param before: the names of the markers in the ``before`` file. :param after: the names of the markers in the ``after`` file. :param outFileName: the name of the output file. :type before: set :type after: set :type outFileName: str Finds the difference between two sets of markers, and write them in the ``outFileName`` file. .. note:: A :py:class:`ProgramError` is raised if: 1. There are more markers in the ``after`` set than in the ``before`` set. 2. Some markers that are in the ``after`` set are not in the ``before`` set. """

    # First, check that "before" is larger than "after"
    if len(after) > len(before):
        msg = "there are more SNPs after than before"
        raise ProgramError(msg)

    # Checks that all the SNPs "after" are in "before"
    if not (after <= before):
        msg = "some after SNPs are not in before"
        raise ProgramError(msg)

    # Printing the SNPs
    try:
        with open(outFileName, "w") as outputFile:
            differences = before - after
            if len(differences) > 0:
                print >>outputFile, "\n".join(differences)
    except IOError:
        msg = "%(outFileName)s: can't write to file" % locals()
        raise ProgramError(msg)