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

    def _get_filters():
        filters = frappe._dict({u'docstatus': [u'!=', 2]})
        if meta.has_field(u'enabled'):
            filters.enabled = 1
        if meta.has_field(u'disabled'):
            filters.disabled = 0
        return filters
    meta = frappe.get_meta(doctype)
    if (cint(meta.istable) == 1):
        parent_doctypes = frappe.get_all(u'DocField', fields=u'parent', filters={u'fieldtype': u'Table', u'options': doctype})
        for p in parent_doctypes:
            rebuild_for_doctype(p.parent)
        return
    delete_global_search_records_for_doctype(doctype)
    parent_search_fields = meta.get_global_search_fields()
    fieldnames = get_selected_fields(meta, parent_search_fields)
    all_records = frappe.get_all(doctype, fields=fieldnames, filters=_get_filters())
    (all_children, child_search_fields) = get_children_data(doctype, meta)
    all_contents = []
    for doc in all_records:
        content = []
        for field in parent_search_fields:
            value = doc.get(field.fieldname)
            if value:
                content.append(get_formatted_value(value, field))
        for (child_doctype, records) in all_children.get(doc.name, {}).items():
            for field in child_search_fields.get(child_doctype):
                for r in records:
                    if r.get(field.fieldname):
                        content.append(get_formatted_value(r.get(field.fieldname), field))
        if content:
            published = 0
            (title, route) = (u'', u'')
            try:
                if (hasattr(get_controller(doctype), u'is_website_published') and meta.allow_guest_to_view):
                    d = frappe.get_doc(doctype, doc.name)
                    published = (1 if d.is_website_published() else 0)
                    title = d.get_title()
                    route = d.get(u'route')
            except ImportError:
                pass
            all_contents.append({u'doctype': frappe.db.escape(doctype), u'name': frappe.db.escape(doc.name), u'content':...

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

def rebuild_for_doctype(doctype):