def METHOD_NAME(folder, files):
    file_storage = libtorrent.file_storage()
    file_storage.set_name(folder.name)
    for file in files:
        relative = file.relative_to(folder.parent)
        size = file.stat().st_size
        file_storage.add_file(str(relative), size)
    flags = libtorrent.create_torrent_flags_t.optimize
    torrent = libtorrent.create_torrent(file_storage, flags=flags)
    torrent.set_creator(_creator)
    libtorrent.set_piece_hashes(torrent, str(folder.parent))
    torrent_data = torrent.generate()
    return torrent_data, libtorrent.bencode(torrent_data)