<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def gaps(args):
 """ %prog gaps A_vs_B.blast Find distribution of gap sizes betwen adjacent HSPs. """

    p = OptionParser(gaps.__doc__)
    opts, args = p.parse_args(args)

    if len(args) != 1:
        sys.exit(not p.print_help())

    blastfile, = args
    blast = BlastSlow(blastfile)
    logging.debug("A total of {} records imported".format(len(blast)))

    query_gaps = list(collect_gaps(blast))
    subject_gaps = list(collect_gaps(blast, use_subject=True))
    logging.debug("Query gaps: {}  Subject gaps: {}"\
                    .format(len(query_gaps), len(subject_gaps)))

    from jcvi.graphics.base import savefig
    import seaborn as sns

    sns.distplot(query_gaps)
    savefig("query_gaps.pdf")