code: def UpdateVFSFileAndWait(client_id,
                           vfs_file_urn,
                           token=None,
                           timeout=DEFAULT_TIMEOUT):
    
    # Wait for the UpdateVFSFile flow.
    update_flow_urn = StartFlowAndWait(
        client_id,
        token=token,
        timeout=timeout,
        flow_name=aff4_grr.UpdateVFSFile.__name__,
        vfs_file_urn=vfs_file_urn)
  
    update_flow_obj = aff4.FACTORY.Open(
        update_flow_urn, token=token, aff4_type=flow.GRRFlow)
  
    # Get the child flow so we can wait for it too.
    sub_flow_urn = update_flow_obj.state.get_file_flow_urn
  
    # If there was no subflow, no need to wait for it.
    if not sub_flow_urn:
      return
  
    WaitForFlow(sub_flow_urn, token=token, timeout=timeout)
docs: Waits for a file to be updated on the client.
  
    Calls the UpdateVFSFile flow on a urn and waits for both it and the
    ListDirectory flow it calls to finish.
  
    Note that this is needed because any flows UpdateVFSFile calls via
    VFS Update methods will not become child flows of UpdateVFSFile,
    and therefore waiting for UpdateVFSFile to complete is not enough.
  
    Args:
      client_id: Which client to run the flow on.
      vfs_file_urn: Path to VFSFile to update.
      token: The datastore access token.
      timeout: How long to wait for a flow to finish, maximum.