<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_sample_files(fam_filename, raw_dirname):
 """Checks the raw sample files. :param fam_filename: the name of the FAM file. :param raw_dirname: the name of the directory containing the raw file. :type fam_filename: str :type raw_dirname: str :returns: the set of all the sample files that are compatible with the FAM file. :rtype: set """

    # Reading the sample identification number from the FAM file
    fam_samples = None
    with open(fam_filename, "r") as i_file:
        fam_samples = {line.split()[1] for line in i_file.read().splitlines()}

    # Checking the files in the raw directory
    sample_files = set()
    all_samples = set()
    for filename in glob.glob(os.path.join(raw_dirname, "*")):
        sample = os.path.splitext(os.path.basename(filename))[0]
        all_samples.add(sample)
        if sample not in fam_samples:
            logger.warning("{}: sample not in FAM file".format(sample))
        else:
            sample_files.add(filename)

    for sample in fam_samples - all_samples:
        logger.warning("{}: sample not in raw directory".format(sample))

    if len(sample_files) == 0:
        raise ProgramError("no sample left for analysis")

    return sample_files