<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def determine_sex( snps, y_snps_not_null_threshold=0.1, heterozygous_x_snps_threshold=0.01 ):
 """ Determine sex from SNPs using thresholds. Parameters snps : pandas.DataFrame y_snps_not_null_threshold : float percentage Y SNPs that are not null; above this threshold, Male is determined heterozygous_x_snps_threshold : float percentage heterozygous X SNPs; above this threshold, Female is determined Returns ------- str 'Male' or 'Female' if detected, else empty str """


    if isinstance(snps, pd.DataFrame):
        y_snps = len(snps.loc[(snps["chrom"] == "Y")])

        if y_snps > 0:
            y_snps_not_null = len(
                snps.loc[(snps["chrom"] == "Y") & (snps["genotype"].notnull())]
            )

            if y_snps_not_null / y_snps > y_snps_not_null_threshold:
                return "Male"
            else:
                return "Female"

        x_snps = len(snps.loc[snps["chrom"] == "X"])

        if x_snps == 0:
            return ""

        heterozygous_x_snps = len(
            snps.loc[
                (snps["chrom"] == "X")
                & (snps["genotype"].notnull())
                & (snps["genotype"].str[0] != snps["genotype"].str[1])
            ]
        )

        if heterozygous_x_snps / x_snps > heterozygous_x_snps_threshold:
            return "Female"
        else:
            return "Male"
    else:
        return ""