<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _process_permission(perm):
 """Rebuild indexes affected by the given permission."""

    # XXX: Optimize: rebuild only permissions, not whole document
    codename = perm.permission.codename
    if not codename.startswith('view') and not codename.startswith('owner'):
        return

    index_builder.build(perm.content_object)