code: def count_human_bot_lengths(df, human=None, bot=None):
      import re
  
      len_human_min = []
      len_human_max = []
      len_human_mean = []
      len_bot_min = []
      len_bot_max = []
      len_bot_mean = []
      human = human or "<human>:"
      bot = bot or "<bot>:"
      for is_human in [True, False]:
          what = human if is_human else bot
          other = human if not is_human else bot
          for i in range(df.shape[0]):
              text = df.loc[i, "text"]
              assert isinstance(text, str)
              starts = [m.start() for m in re.finditer(what, text)]
              if len(starts) == 1:
                  starts = [
                      starts[0],
                      len(text),
                  ]  # always go into for loop below
              assert len(text)
              list_what = []
              for ii in range(len(starts) - 1):
                  interaction = text[starts[ii] : starts[ii + 1]]
                  if other in interaction:
                      interaction = interaction[
                          : interaction.find(other)
                      ]
                  interaction.strip()
                  list_what.append(interaction)
              if not list_what:
                  list_what = [
                      ""
                  ]  # handle corrupted data, very rare, leads to sizes 0
              if is_human:
                  len_human_min.append(min([len(x) for x in list_what]))
                  len_human_max.append(max([len(x) for x in list_what]))
                  len_human_mean.append(
                      np.mean([len(x) for x in list_what])
                  )
              else:
                  len_bot_min.append(min([len(x) for x in list_what]))
                  len_bot_max.append(max([len(x) for x in list_what]))
                  len_bot_mean.append(
                      np.mean([len(x) for x in list_what])
                  )
      df["len_human_min"] = len_human_min
      df["len_human_max"] = len_human_max
      df["len_human_mean"] = len_human_mean
      df["len_bot_min"] = len_bot_min
      df["len_bot_max"] = len_bot_max
      df["len_bot_mean"] = len_bot_mean
      np.random.seed(1234)
      pd.set_option("display.max_columns", None)
      print("Before chopping")
      print(df.describe())
      return df
  
imports: import ast
  import concurrent.futures
  import contextlib
  import hashlib
  import json
  import os
  import shutil
  import signal
  import sys
  import traceback
  from concurrent.futures import ProcessPoolExecutor
  import psutil
  import pytest
  import pandas
  import numpy
  from tqdm import tqdm
  from utils import flatten_list, remove
  from joblib import Parallel, delayed, effective_n_jobs
  from sklearn.utils import gen_even_slices
  from sklearn.utils.validation import _num_samples
label_desc: Use image node_id 30 for calling a global function with example usage: count_human_bot_lengths(df, human, bot) and returns: df