def AddFile(self, fd, sync=False, external=True):
    files_for_write = []

    for sub_store in self.GetChildrenByPriority(allow_external=external):
      new_file = sub_store.AddFile(fd, sync=sync)
      if new_file:
        files_for_write.append(new_file)

    fd.Seek(0)
    while files_for_write:
      # If we got filehandles back, send them the data.
      data = fd.Read(self.CHUNK_SIZE)
      if not data: break

      for child in files_for_write:
        child.Write(data)

    for child in files_for_write:
      child.Close(sync=sync)
Create a new file in the file store.
dataset/ETHPy150Open google/grr/grr/lib/aff4_objects/filestore.py/FileStore.AddFile