human
I wrote the below code

    T = current.T
    s3db = current.s3db
    s3 = current.response.s3
    request = current.request
    settings = current.deployment_settings
    output = {}
    viewing = request.get_vars.get('viewing', None)
    if (not viewing):
        return output
    if ('.' in viewing):
        (tablename, record_id) = viewing.split('.', 1)
    else:
        return output
    customise = settings.get(('customise_%s_resource' % tablename))
    if customise:
        try:
            customise(request, tablename)
        except:
            s3_debug(("customise_%s_resource    is    using    attributes    of    r    which    aren't    in    request" % tablename))
            pass
    table = s3db[tablename]
    row = current.db((table.id == record_id)).select(table.site_id, limitby=(0, 1)).first()
    if row:
        site_id = row.site_id
    else:
        return output
    actions = [dict(label=s3_unicode(T('Check')).encode('utf8'), url=URL(c='req', f='req', args=['[id]', 'check'], vars={'site_id': site_id}), _class='action-btn')]
    if current.auth.s3_has_permission('update', tablename, record_id):
        if settings.get_req_use_commit():
            actions.append(dict(label=s3_unicode(T('Commit')).encode('utf8'), url=URL(c='req', f='commit_req', args=['[id]'], vars={'site_id': site_id}), _class='action-btn'))
    s3.actions = actions
    if (rheader is None):
        if (tablename == 'org_office'):
            rheader = s3db.org_rheader
        elif (tablename == 'org_facility'):
            rheader = s3db.org_facility_rheader
        elif (tablename == 'inv_warehouse'):
            rheader = s3db.inv_rheader
        elif (tablename == 'cr_shelter'):
            rheader = s3db.cr_shelter_rheader
        elif (tablename == 'hms_hospital'):
            rheader = s3db.hms_hospital_rheader
    s3.filter = (s3db.req_req.site_id != site_id)
    s3db.configure('req_req', insertable=False)
    def prep(r):
        S3OrgRoleManager.set_method(r, entity=tablename, record_id=record_id)
        return True
    s3.prep = prep
...

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

def req_match(rheader=None):