docs: def make_permalink(img_id):
      """
      Removes tmp prefix from filename and rename main and variant files.
      Returns img_id without tmp prefix.
      """
      profile, filename = img_id.split(':', 1)
      new_img_id = profile + ':' + remove_tmp_prefix_from_filename(filename)
      urls = get_files_by_img_id(img_id)
      if urls is None:
          return urls
      move_list = {(urls['main'], remove_tmp_prefix_from_file_path(urls['main']))}
      for var_label, var_file_path in urls['variants'].iteritems():
          move_list.add((var_file_path, remove_tmp_prefix_from_file_path(var_file_path)))
      for file_path_from, file_path_to in move_list:
          os.rename(media_path(file_path_from), media_path(file_path_to))
      return new_img_id