code: def parse_messages(input):
      if input is None:
          return None
  
      def clean_message(message):
          # if is strin, return as is
          if isinstance(message, str):
              return message
  
          if "message" in message:
              return clean_message(message["message"])
          text = message["content"]
          if text == None:
              text = message.get("function_call", None)
  
          return {
              "role": message["role"],
              "text": text,
          }
  
      if isinstance(input, list):
          if len(input) == 1:
              return clean_message(input[0])
          else:
              return [clean_message(msg) for msg in input]
      else:
          return clean_message(input)
  
file_path: litellm/litellm/integrations/llmonitor.py
imports: import datetime
  import traceback
  import dotenv
  import os
  import requests
label_desc: Use image node_id 2 for calling a global function with example usage: parse_messages(input) and returns: None, dict, clean_message, message, clean_message, clean_message, unknown