human
I wrote the below code

    if (fields is not None):
        r = rec_keep_fields(r, fields)
    if cbook.is_numlike(precision):
        precision = ([precision] * len(r.dtype))
    def get_type(item, atype=int):
        tdict = {None: int, int: float, float: str}
        try:
            atype(str(item))
        except:
            return get_type(item, tdict[atype])
        return atype
    def get_justify(colname, column, precision):
        ntype = column.dtype
        if np.issubdtype(ntype, np.character):
            fixed_width = int(ntype.str[2:])
            length = max(len(colname), fixed_width)
            return (0, (length + padding), u'%s')
        if np.issubdtype(ntype, np.integer):
            length = max(len(colname), np.max(list(map(len, list(map(str, column))))))
            return (1, (length + padding), u'%d')
        if np.issubdtype(ntype, np.floating):
            fmt = ((u'%.' + str(precision)) + u'f')
            length = max(len(colname), np.max(list(map(len, list(map((lambda x: (fmt % x)), column))))))
            return (1, (length + padding), fmt)
        return (0, (max(len(colname), np.max(list(map(len, list(map(str, column)))))) + padding), u'%s')
    if (header is None):
        header = r.dtype.names
    justify_pad_prec = [get_justify(header[i], r.__getitem__(colname), precision[i]) for (i, colname) in enumerate(r.dtype.names)]
    justify_pad_prec_spacer = []
    for i in range(len(justify_pad_prec)):
        (just, pad, prec) = justify_pad_prec[i]
        if (i == 0):
            justify_pad_prec_spacer.append((just, pad, prec, 0))
        else:
            (pjust, ppad, pprec) = justify_pad_prec[(i - 1)]
            if ((pjust == 0) and (just == 1)):
                justify_pad_prec_spacer.append((just, (pad - padding), prec, 0))
            elif ((pjust == 1) and (just == 0)):
                justify_pad_prec_spacer.append((just, pad, prec, padding))
            else:
                justify_pad_prec_spacer.append((just, pad, prec, 0))
    def format(item, just_pad_prec_spacer):
       ...

What's a good function header?
 ... Here's a good function header?
assistant
#Here's a good function header.

def rec2txt(r, header=None, padding=3, precision=3, fields=None):