docs: def copy(tree, source_filename):
      """ Copy file in tree, show a progress bar during operations,
          and return the sha1 sum of copied file.
      """
      #_, ext = os.path.splitext(source_filename)
      filehash = sha1()
      with printer.progress(os.path.getsize(source_filename)) as update:
          with open(source_filename, 'rb') as fsource:
              with NamedTemporaryFile(dir=os.path.join(tree, '.kolekto', 'movies'), delete=False) as fdestination:
                  # Copy the source into the temporary destination:
                  while True:
                      buf = fsource.read(10 * 1024)
                      if not buf:
                          break
                      filehash.update(buf)
                      fdestination.write(buf)
                      update(len(buf))
                  # Rename the file to its final name or raise an error if
                  # the file already exists:
                  dest = os.path.join(tree, '.kolekto', 'movies', filehash.hexdigest())
                  if os.path.exists(dest):
                      raise IOError('This file already exists in tree (%s)' % filehash.hexdigest())
                  else:
                      os.rename(fdestination.name, dest)
      return filehash.hexdigest()