<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _UpdateChildIndex(self, urn, mutation_pool):
 """Update the child indexes. This function maintains the index for direct child relations. When we set an AFF4 path, we always add an attribute like index:dir/%(childname)s to its parent. This is written asynchronously to its parent. In order to query for all direct children of an AFF4 object, we then simple get the attributes which match the regex index:dir/.+ which are the direct children. Args: urn: The AFF4 object for which we update the index. mutation_pool: A MutationPool object to write to. """

    try:
      # Create navigation aids by touching intermediate subject names.
      while urn.Path() != "/":
        basename = urn.Basename()
        dirname = rdfvalue.RDFURN(urn.Dirname())

        try:
          self.intermediate_cache.Get(urn)
          return
        except KeyError:
          extra_attributes = None
          # This is a performance optimization. On the root there is no point
          # setting the last access time since it gets accessed all the time.
          # TODO(amoser): Can we get rid of the index in the root node entirely?
          # It's too big to query anyways...
          if dirname != u"/":
            extra_attributes = {
                AFF4Object.SchemaCls.LAST: [
                    rdfvalue.RDFDatetime.Now().SerializeToDataStore()
                ]
            }

          mutation_pool.AFF4AddChild(
              dirname, basename, extra_attributes=extra_attributes)

          self.intermediate_cache.Put(urn, 1)

          urn = dirname

    except access_control.UnauthorizedAccess:
      pass