<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def spancount(args):
 """ %prog spancount list_of_fillingMetrics Count span support for each gap. A file with paths of all fillingMetrics can be built with Linux `find`. $ (find assembly -name "fillingMetrics.json" -print > list_of_fillMetrics 2> /dev/null &) """

    import json

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

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

    fof, = args
    fp = open(fof)
    flist = [row.strip() for row in fp]
    spanCount = "spanCount"
    avgSpanBases = "avgSpanBases"
    fw = open(spanCount, "w")
    for f in flist:
        fp = open(f)
        j = json.load(fp)
        sc = j.get(spanCount, None)
        asb = j.get(avgSpanBases, None)
        print(f, asb, sc, file=fw)
        fw.flush()
    fw.close()