<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_ploidy(items, region=None):
 """Retrieve ploidy of a region, handling special cases. """

    chrom = chromosome_special_cases(region[0] if isinstance(region, (list, tuple))
                                     else None)
    ploidy = _configured_ploidy(items)
    sexes = _configured_genders(items)
    if chrom == "mitochondrial":
        # For now, do haploid calling. Could also do pooled calling
        # but not entirely clear what the best default would be.
        return ploidy.get("mitochondrial", 1)
    elif chrom == "X":
        # Do standard diploid calling if we have any females or unspecified.
        if "female" in sexes or "f" in sexes:
            return ploidy.get("female", ploidy["default"])
        elif "male" in sexes or "m" in sexes:
            return ploidy.get("male", 1)
        else:
            return ploidy.get("female", ploidy["default"])
    elif chrom == "Y":
        # Always call Y single. If female, filter_vcf_by_sex removes Y regions.
        return 1
    else:
        return ploidy["default"]