How do you write a .gz fastq file with Biopython? How do you write a .gz (or .bgz) fastq file using Biopython? 

I'd rather avoid a separate system call.

The typical way to write an ASCII .fastq is done as follows:

for record in SeqIO.parse(fasta, "fasta"):
    SeqIO.write(record, fastq, "fastq")


The record is a SeqRecord object, fastq is the file handle, and "fastq" is the requested file format. The file format may be fastq, fasta, etc., but I do not see an option for .gz. 

Here is the SeqIO API.
I'm not sure I'm doing it the best way, but here is an example where I read a compressed gzip fastq file and write the records in block gzip fastq:

from Bio import SeqIO, bgzf
# Used to convert the fastq stream into a file handle
from io import StringIO
from gzip import open as gzopen

records = SeqIO.parse(
    # There is actually simpler (thanks @peterjc)
    # StringIO(gzopen("random_10.fastq.gz").read().decode("utf-8")),
    gzopen("random_10.fastq.gz", "rt"),
    format="fastq")

with bgzf.BgzfWriter("test.fastq.bgz", "wb") as outgz:
    SeqIO.write(sequences=records, handle=outgz, format="fastq")