def write_details(fw, details, bed):
    """
    Write per gene depth to file
    """
    for a, b, depth in details:
        for i in xrange(a, b):
            gi = bed[i].accn
            print("\t".join((gi, str(depth))), file=fw)
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 )
Write per gene depth to file