def _get_generator(parser, extract, keep, check_maf):
    """Generates the data (with extract markers and keep, if required."""
    if extract is not None:
        parser = Extractor(parser, names=extract)

    for data in parser.iter_genotypes():
        data.genotypes = data.genotypes[keep]

        # Checking the MAF, if required
        if check_maf:
            data.code_minor()

        yield data
Generates the data (with extract markers and keep, if required.