code: def normalize_map_join(map_join):
      if map_join is None:
          return None
  
      def invalid_map_join_format():
          return ValueError(
              "map_join must be a str, list[str] or pair of list[str]"
          )
  
      if isinstance(map_join, str):  # 'foo' -> [['foo'], None]
          data_names = [map_join]
          map_names = None
      elif isinstance(map_join, Sequence):
          if all(
              isinstance(v, str) for v in map_join
          ):  # all items are strings
              if len(map_join) == 1:  # ['foo'] -> [['foo'], None]
                  data_names = map_join
                  map_names = None
              elif (
                  len(map_join) == 2
              ):  # ['foo', 'bar'] -> [['foo'], ['bar']]
                  data_names = [map_join[0]]
                  map_names = [map_join[1]]
              elif len(map_join) > 2:  # ['foo', 'bar', 'baz'] -> error
                  raise ValueError(
                      "map_join of type list[str] expected to have 1 or 2 items, but was {}".format(
                          len(map_join)
                      )
                  )
              else:
                  raise invalid_map_join_format()
          elif all(
              isinstance(v, Sequence) and not isinstance(v, str)
              for v in map_join
          ):  # all items are lists
              if (
                  len(map_join) == 1
              ):  # [['foo', 'bar']] -> [['foo', 'bar'], None]
                  data_names = map_join[0]
                  map_names = None
              elif (
                  len(map_join) == 2
              ):  # [['foo', 'bar'], ['baz', 'qux']] -> [['foo', 'bar'], ['baz', 'qux']]
                  data_names = map_join[0]
                  map_names = map_join[1]
              else:
                  raise invalid_map_join_format()
          else:
              raise invalid_map_join_format()
  
      else:
          raise invalid_map_join_format()
  
      return [data_names, map_names]
  
file_path: lets-plot/python-package/lets_plot/plot/util.py
imports: from collections.abc import Iterable
  from datetime import datetime
  from typing import Any, Tuple, Sequence, Optional, Dict
  from lets_plot._type_utils import is_dict_or_dataframe
  from lets_plot.geo_data_internals.utils import find_geo_names
  from lets_plot.mapping import MappingMeta
  from lets_plot.plot.core import aes
label_desc: Use image node_id 4 for calling a global function with example usage: normalize_map_join(map_join) and returns: list, None, ValueError