human
Here's a good function header given the following:
I wrote the below code

    def prep(r):
        table = r.table
        resource = r.resource
        get_vars = r.get_vars
        if ('viewing' in get_vars):
            try:
                (vtablename, record_id) = get_vars['viewing'].split('.')
            except ValueError:
                return False
            if (vtablename == 'pr_person'):
                gtable = s3db.pr_group
                join = gtable.on((gtable.id == table.group_id))
                query = (((table.person_id == record_id) & (gtable.group_type == 7)) & (table.deleted != True))
                rows = db(query).select(table.group_id, join=join)
                group_ids = set((row.group_id for row in rows))
                if group_ids:
                    group_id = (tuple(group_ids)[0] if (len(group_ids) == 1) else None)
                elif (r.http == 'POST'):
                    name = s3_fullname(record_id)
                    group_id = gtable.insert(name=name, group_type=7)
                    s3db.update_super(gtable, {'id': group_id})
                    table.insert(group_id=group_id, person_id=record_id, group_head=True)
                    group_ids = set((group_id,))
                resource.add_filter((FS('person_id') != record_id))
            else:
                group_ids = set()
            if (not r.id):
                if (len(group_ids) == 1):
                    r.resource.add_filter((FS('group_id') == group_id))
                else:
                    r.resource.add_filter(FS('group_id').belongs(group_ids))
            list_fields = ['person_id', 'person_id$gender', 'person_id$date_of_birth']
            if (len(group_ids) == 0):
                field = table.group_id
                field.readable = field.writable = False
            elif (len(group_ids) == 1):
                field = table.group_id
                field.default = group_id
                field.readable = field.writable = False
            elif (len(group_ids) > 1):
                list_fields.insert(0, 'group_id')
           ...

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

def group_membership():