code: def sanitize_gff_file(gff_fname,
                        in_memory=True,
                        in_place=False):
      
      db = None
      if is_gff_db(gff_fname):
          # It's a database filename, so load it
          db = gffutils.FeatureDB(gff_fname)
      else:
          # Need to create a database for file
          if in_memory:
              db = gffutils.create_db(gff_fname, ":memory:",
                                      verbose=False)
          else:
              db = get_gff_db(gff_fname)
      if in_place:
          gff_out = gffwriter.GFFWriter(gff_fname,
                                        in_place=in_place)
      else:
          gff_out = gffwriter.GFFWriter(sys.stdout)
      sanitized_db = sanitize_gff_db(db)
      for gene_rec in sanitized_db.all_features(featuretype="gene"):
          gff_out.write_gene_recs(sanitized_db, gene_rec.id)
      gff_out.close()
docs: Sanitize a GFF file.