code: def write_details(fw, details, bed):
      
      for a, b, depth in details:
          for i in xrange(a, b):
              gi = bed[i].accn
              print("\t".join((gi, str(depth))), file=fw)
docs: Write per gene depth to file