docs: def sort_snps(snps):
      """ Sort SNPs based on ordered chromosome list and position. """
  
      sorted_list = sorted(snps["chrom"].unique(), key=_natural_sort_key)
  
      # move PAR and MT to the end of the dataframe
      if "PAR" in sorted_list:
          sorted_list.remove("PAR")
          sorted_list.append("PAR")
  
      if "MT" in sorted_list:
          sorted_list.remove("MT")
          sorted_list.append("MT")
  
      # convert chrom column to category for sorting
      # https://stackoverflow.com/a/26707444
      snps["chrom"] = snps["chrom"].astype(
          CategoricalDtype(categories=sorted_list, ordered=True)
      )
  
      # sort based on ordered chromosome list and position
      snps = snps.sort_values(["chrom", "pos"])
  
      # convert chromosome back to object
      snps["chrom"] = snps["chrom"].astype(object)
  
      return snps