code: def _make_messages(
      messages: discuss_types.MessagesOptions,
  ) -> List[glm.Message]:
      """
      Creates a list of `glm.Message` objects from the provided messages.
  
      This function takes a variety of message content inputs, such as strings, dictionaries,
      or `glm.Message` objects, and creates a list of `glm.Message` objects. It ensures that
      the authors of the messages alternate appropriately. If authors are not provided,
      default authors are assigned based on their position in the list.
  
      Args:
          messages: The messages to convert.
  
      Returns:
          A list of `glm.Message` objects with alternating authors.
      """
      if isinstance(messages, (str, dict, glm.Message)):
          messages = [_make_message(messages)]
      else:
          messages = [_make_message(message) for message in messages]
  
      even_authors = set(
          msg.author for msg in messages[::2] if msg.author
      )
      if not even_authors:
          even_author = "0"
      elif len(even_authors) == 1:
          even_author = even_authors.pop()
      else:
          raise discuss_types.AuthorError(
              "Authors are not strictly alternating"
          )
  
      odd_authors = set(
          msg.author for msg in messages[1::2] if msg.author
      )
      if not odd_authors:
          odd_author = "1"
      elif len(odd_authors) == 1:
          odd_author = odd_authors.pop()
      else:
          raise discuss_types.AuthorError(
              "Authors are not strictly alternating"
          )
  
      if all(msg.author for msg in messages):
          return messages
  
      authors = [even_author, odd_author]
      for i, msg in enumerate(messages):
          msg.author = authors[i % 2]
  
      return messages
  
imports: from __future__ import annotations
  import dataclasses
  import sys
  import textwrap
  from typing import Iterable, List, Optional, Union
  import google.ai.generativelanguage
  from google.generativeai.client import get_default_discuss_client
  from google.generativeai.client import get_default_discuss_async_client
  from google.generativeai import string_utils
  from google.generativeai.types import discuss_types
  from google.generativeai.types import model_types
  from google.generativeai.types import safety_types
label_desc: Use image node_id 2 for calling a global function with example usage: _make_messages(messages) and returns: messages, messages