human
I wrote the below code

    def prep(r):
        person_id = get_vars.get('person', None)
        if person_id:
            controller = get_vars.get('controller', 'pr')
            access = get_vars.get('access', None)
            if (access is None):
                method = 'contacts'
            elif (access == '1'):
                method = 'private_contacts'
            elif (access == '2'):
                method = 'public_contacts'
            s3db.configure('pr_contact_emergency', create_next=URL(c=controller, f='person', args=[person_id, method]), update_next=URL(c=controller, f='person', args=[person_id, method]))
            if (r.method == 'create'):
                table = s3db.pr_person
                query = (table.id == person_id)
                pe_id = db(query).select(table.pe_id, limitby=(0, 1)).first().pe_id
                s3db.pr_contact_emergency.pe_id.default = pe_id
        else:
            field = s3db.pr_contact_emergency.pe_id
            if ((r.method == 'create') and (r.representation == 'popup')):
                pe_id = get_vars.get('~.pe_id', None)
                if pe_id:
                    field.default = pe_id
                else:
                    field.label = T('Entity')
                    field.readable = field.writable = True
        return True
    s3.prep = prep
    output = s3_rest_controller()
    return output

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

def contact_emergency():