human
I wrote the below code

    delimiter = str(delimiter)
    if (missingd is None):
        missingd = dict()
    def with_mask(func):
        def newfunc(val, mask, mval):
            if mask:
                return mval
            else:
                return func(val)
        return newfunc
    if (r.ndim != 1):
        raise ValueError(u'rec2csv    only    operates    on    1    dimensional    recarrays')
    formatd = get_formatd(r, formatd)
    funcs = []
    for (i, name) in enumerate(r.dtype.names):
        funcs.append(with_mask(csvformat_factory(formatd[name]).tostr))
    (fh, opened) = cbook.to_filehandle(fname, u'wb', return_opened=True)
    writer = csv.writer(fh, delimiter=delimiter)
    header = r.dtype.names
    if withheader:
        writer.writerow(header)
    mvals = []
    for name in header:
        mvals.append(missingd.get(name, missing))
    ismasked = False
    if len(r):
        row = r[0]
        ismasked = hasattr(row, u'_fieldmask')
    for row in r:
        if ismasked:
            (row, rowmask) = (row.item(), row._fieldmask.item())
        else:
            rowmask = ([False] * len(row))
        writer.writerow([func(val, mask, mval) for (func, val, mask, mval) in zip(funcs, row, rowmask, mvals)])
    if opened:
        fh.close()

What's a good function header?

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

def rec2csv(r, fname, delimiter=u',', formatd=None, missing=u'', missingd=None, withheader=True):