<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _read_mesafile(filename,data_rows=0,only='all'):
 """ private routine that is not directly called by the user"""

    f=open(filename,'r')
    vv=[]
    v=[]
    lines = []
    line  = ''
    for i in range(0,6):
        line = f.readline()
        lines.extend([line])

    hval  = lines[2].split()
    hlist = lines[1].split()
    header_attr = {}
    for a,b in zip(hlist,hval):
        header_attr[a] = float(b)
    if only is 'header_attr':
        return header_attr

    cols    = {}
    colnum  = lines[4].split()
    colname = lines[5].split()
    for a,b in zip(colname,colnum):
        cols[a] = int(b)

    data = []

    old_percent = 0
    for i in range(data_rows):
        # writing reading status
        percent = int(i*100/np.max([1, data_rows-1]))
        if percent >= old_percent + 5:
            sys.stdout.flush()
            sys.stdout.write("\r reading " + "...%d%%" % percent)
            old_percent = percent
        line = f.readline()
        v=line.split()
        try:
            vv=np.array(v,dtype='float64')
        except ValueError:
            for item in v:
                if item.__contains__('.') and not item.__contains__('E'):
                    v[v.index(item)]='0'
        data.append(vv)

    print(' \n')
    f.close()
    a=np.array(data)
    data = []
    return header_attr, cols, a