code: def extract_full(rec, sites, flank, fw):
      
      for s in sites:
          newid = "{0}:{1}".format(rec.name, s)
          left = max(s - flank, 0)
          right = min(s + flank, len(rec))
          frag = rec.seq[left:right].strip("Nn")
          newrec = SeqRecord(frag, id=newid, description="")
          SeqIO.write([newrec], fw, "fasta")
docs: Full extraction of seq flanking the sites.