#! /usr/bin/env python

import sys
import argparse
from Bio import SeqIO

parser = argparse.ArgumentParser()
parser.add_argument(
    "infile", nargs="?", default=sys.stdin, help="filename (default: stdin)"
)
parser.add_argument(
    "-i", "--id", action="append", help="Seq id to select, multiples okay"
)
args = parser.parse_args()

if args.id:
    for r in SeqIO.parse(args.infile, "fasta"):
        id = str(r.id)
        stext = str(r.seq)
        desc = str(r.description)
        if id in args.id:
            print(f">{desc}")
            print(f"{stext}")
