Can you write the documentation for this python function using the most popular formatting : 

async def paginate(ctx, msg_iter, thumb_url, page):
    page = int(page) - 1
    msg_iter_list = False
    if isinstance(msg_iter, list):
        msg_iter_list = msg_iter
        msg_iter = msg_iter_list[page]

    head, desc, foot, field_name, *msg_list = msg_iter
    max_page = len(msg_list)
    max_entry = 1
    if msg_iter_list:
        max_entry = len(msg_iter_list)
        msg_iter_list[page] = [head, desc, foot, field_name, *msg_list]
        # msg_iter_list = [list(msg_it) for msg_it in msg_iter_list]

    cycle_thumb = False
    if isinstance(thumb_url, (tuple,list)):
        cycle_thumb = thumb_url
    cycle_field = False
    if isinstance(field_name, tuple):
        cycle_field = field_name

    action_row_entry = ctx.bot.rest.build_message_action_row()
    val_entry_id = "buttonValEntry"
    val_entry_button = (
            action_row_entry
            .add_button(hikari.ButtonStyle.PRIMARY, val_entry_id)
            .set_label("")
            .set_emoji("\u2705")
        )
    prev_entry_id = "buttonPrevEntry"
    prev_entry_button = (
            action_row_entry
            .add_button(hikari.ButtonStyle.PRIMARY, prev_entry_id)
            .set_label("")
            .set_emoji("\u23EE")
        )
    next_entry_id = "buttonNextEntry"
    next_entry_button = (
            action_row_entry
            .add_button(hikari.ButtonStyle.PRIMARY, next_entry_id)
            .set_label("")
            .set_emoji("\u23ED")
        )
    prev_entry_button.add_to_container()
    val_entry_button.add_to_container()
    compo_entry = next_entry_button.add_to_container()


    action_row = ctx.bot.rest.build_message_action_row()
    prev_id = "buttonPrev"
    prev_button = (
            action_row
            .add_button(hikari.ButtonStyle.PRIMARY, prev_id)
            .set_label("Prev")
            .set_emoji("\u25C0")
        )
    next_id = "buttonNext"
    next_button = (
            action_row
            .add_button(hikari.ButtonStyle.PRIMARY, next_id)
            .set_label("Next")
            .set_emoji("\u25B6")
        )
    prev_button.add_to_container()
    compo = next_button.add_to_container()
    next_button.set_is_disabled(page == max_page - 1)
    prev_button.set_is_disabled(page == 0)

    if max_entry > 1:
        new_foot = foot + f" \u2022 {page+1}/{max_entry}"
    else:
        new_foot = foot + f" \u2022 {page+1}/{max_page}"
    msg = msg_list[0]
    if cycle_thumb:
        thumb_url = cycle_thumb[page%len(cycle_thumb)]
        if not isinstance(thumb_url, str):
            thumb_url = list(islice(thumb_url, 1))[0]
        if isinstance(cycle_thumb, list):
            cycle_thumb[page%len(cycle_thumb)] = thumb_url
    if cycle_field:
        field_name = cycle_field[page]
    logging.debug(f"Thumb: {thumb_url}")

    embed = embed_generator(head, new_foot, desc, msg, thumb_url, field_name)
    logging.debug("Embedding initial")
    if max_entry > 1:
        valid_resp = False
        entry_num = page
        resp = await ctx.respond(embed, components=[compo_entry], user_mentions=False)
        logging.debug("Entry Primary response")
        resp_msg = await resp.message()
        logging.debug("Entry Button response")
        with ctx.bot.stream(hikari.InteractionCreateEvent, 5).filter(
            lambda e:
                isinstance(e.interaction, hikari.ComponentInteraction)
                and e.interaction.message.id == resp_msg.id
                and e.interaction.component_type == hikari.ComponentType.BUTTON
        ) as stream:
            async for event in stream:
                button_inter = event.interaction
                button_id = button_inter.custom_id
                if button_id == next_entry_id:
                    entry_num += 1
                elif button_id == prev_entry_id:
                    entry_num -= 1
                elif button_id == val_entry_id:
                    valid_resp = True
                    break

                head, desc, foot, field_name, *msg_list = msg_iter_list[entry_num%max_entry]
                msg = msg_list[0]
                msg_iter_list[entry_num%max_entry] = [head, desc, foot, field_name, *msg_list]
                max_page = len(msg_list)

                new_foot = foot + f" \u2022 {entry_num%max_entry+1}/{max_entry}"
                if cycle_thumb:
                    thumb_url = cycle_thumb[entry_num%len(cycle_thumb)]
                    if not isinstance(thumb_url, str):
                        thumb_url = list(islice(thumb_url, 1))[0]
                    if isinstance(cycle_thumb, list):
                        cycle_thumb[entry_num%len(cycle_thumb)] = thumb_url
                if cycle_field:
                    field_name = cycle_field[entry_num%max_entry]
                embed = embed_generator(head, new_foot, desc, msg, thumb_url, field_name)
                logging.debug("Entry Embedding")
                try:
                    await button_inter.create_initial_response(
                            hikari.ResponseType.MESSAGE_UPDATE,
                            embed=embed,
                            components=[compo_entry],
                    )
                except hikari.NotFoundError:
                    await button_inter.edit_initial_response(
                        embed=embed,
                        components=[compo_entry],
                    )

        cycle_thumb = False
        page = 0

        if max_page == 1:
            compos = []
        else:
            compos = [compo]
        if valid_resp:
            try:
                await button_inter.create_initial_response(
                        hikari.ResponseType.MESSAGE_UPDATE,
                        embed=embed,
                        components=compos,
                )
            except hikari.NotFoundError:
                await button_inter.edit_initial_response(
                    embed=embed,
                    components=compos,
                )
        else:
            await resp_msg.edit(components=compos)
    else:
        if max_page == 1:
            resp = await ctx.respond(embed, components=[], user_mentions=False)
        else:
            resp = await ctx.respond(embed, components=[compo], user_mentions=False)
        logging.debug("Primary response")
        resp_msg = await resp.message()
        logging.debug("Button response")
    with ctx.bot.stream(hikari.InteractionCreateEvent, 180).filter(
        lambda e:
            isinstance(e.interaction, hikari.ComponentInteraction)
            and e.interaction.message.id == resp_msg.id
            and e.interaction.component_type == hikari.ComponentType.BUTTON
    ) as stream:
        async for event in stream:
            button_inter = event.interaction
            button_id = button_inter.custom_id
            if button_id == next_id:
                page += 1
            elif button_id == prev_id:
                page -= 1
            next_button.set_is_disabled(page == max_page - 1)
            prev_button.set_is_disabled(page == 0)

            try:
                assert page >= 0
                msg = msg_list[page]
            except (IndexError, AssertionError):
                if button_id == next_id:
                    page -= 1
                elif button_id == prev_id:
                    page += 1
                next_button.set_is_disabled(page == max_page - 1)
                prev_button.set_is_disabled(page == 0)
            new_foot = foot + f" \u2022 {page+1}/{max_page}"
            if cycle_thumb:
                thumb_url = cycle_thumb[page%len(cycle_thumb)]
                if not isinstance(thumb_url, str):
                    thumb_url = list(islice(thumb_url, 1))[0]
                if isinstance(cycle_thumb, list):
                    cycle_thumb[page%len(cycle_thumb)] = thumb_url
            if cycle_field:
                field_name = cycle_field[page]
            embed = embed_generator(head, new_foot, desc, msg, thumb_url, field_name)
            logging.debug("Embedding")
            try:
                await button_inter.create_initial_response(
                        hikari.ResponseType.MESSAGE_UPDATE,
                        embed=embed,
                        components=[compo],
                )
            except hikari.NotFoundError:
                await button_inter.edit_initial_response(
                    embed=embed,
                    components=[compo],
                )

    await resp_msg.edit(components=[])