<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def chk_genes(self, study, pop, assoc=None):
 """Check gene sets."""

        if len(pop) < len(study):
            exit("\nERROR: The study file contains more elements than the population file. "
                 "Please check that the study file is a subset of the population file.\n")
        # check the fraction of genomic ids that overlap between study and population
        overlap = self.get_overlap(study, pop)
        if overlap < 0.95:
            sys.stderr.write("\nWARNING: only {} fraction of genes/proteins in study are found in "
                             "the population  background.\n\n".format(overlap))
        if overlap <= self.args.min_overlap:
            exit("\nERROR: only {} of genes/proteins in the study are found in the "
                 "background population. Please check.\n".format(overlap))
        # Population and associations
        if assoc is not None and pop.isdisjoint(assoc.keys()):
            if self.objanno.name == 'gene2go':
                err = ('**FATAL: NO POPULATION ITEMS SEEN IN THE NCBI gene2go ANNOTATIONS '
                       'FOR taxid({T}). TRY: --taxid=<taxid number>')
                exit(err.format(T=next(iter(self.objanno.taxid2asscs.keys()))))
            else:
                exit('**FATAL: NO POPULATION ITEMS SEEN IN THE ANNOTATIONS')