code: def _create_frame(
      df: pd.DataFrame,
      right: pd.DataFrame,
      left_index: np.ndarray,
      right_index: np.ndarray,
      how: str,
      df_columns: Any,
      right_columns: Any,
      indicator: Union[bool, str],
  ):
      """
      Create final dataframe
      """
      if (df_columns is None) and (right_columns is None):
          raise ValueError(
              "df_columns and right_columns cannot both be None."
          )
      if (df_columns is not None) and (df_columns != slice(None)):
          df = df.select(columns=df_columns)
      if (right_columns is not None) and (right_columns != slice(None)):
          right = right.select(columns=right_columns)
      if df_columns is None:
          df = pd.DataFrame([])
      elif right_columns is None:
          right = pd.DataFrame([])
  
      if not df.columns.intersection(right.columns).empty:
          df, right = _create_multiindex_column(df, right)
  
      def _add_indicator(
          indicator: Union[bool, str],
          how: str,
          column_length: int,
          columns: pd.Index,
      ):
          """Adds a categorical column to the DataFrame,
          mapping the rows to either the left or right source DataFrames.
  
          Args:
              indicator: Indicator column name or True for default name "_merge".
              how: Type of join operation ("inner", "left", "right").
              column_length: Length of the categorical column.
              columns: Columns of the final DataFrame.
  
          Returns:
              A tuple containing the indicator column name
              and a Categorical array
              representing the indicator values for each row.
  
          """
          mapping = {
              "left": "left_only",
              "right": "right_only",
              "inner": "both",
          }
          categories = ["left_only", "right_only", "both"]
          if isinstance(indicator, bool):
              indicator = "_merge"
          if indicator in columns:
              raise ValueError(
                  "Cannot use name of an existing column for indicator column"
              )
          nlevels = columns.nlevels
          if nlevels > 1:
              indicator = [indicator] + [""] * (nlevels - 1)
              indicator = tuple(indicator)
          if not column_length:
              arr = pd.Categorical([], categories=categories)
          else:
              arr = pd.Categorical(
                  [mapping[how]],
                  categories=categories,
              )
              if column_length > 1:
                  arr = arr.repeat(column_length)
          return indicator, arr
  
      def _inner(
          df: pd.DataFrame,
          right: pd.DataFrame,
          left_index: np.ndarray,
          right_index: np.ndarray,
          indicator: Union[bool, str],
      ):
          """Computes an inner joined DataFrame.
  
          Args:
              df: The left DataFrame to join.
              right: The right DataFrame to join.
              left_index: indices from df for rows that match right.
              right_index: indices from right for rows that match df.
              indicator: Indicator column name or True for default name "_merge".
  
          Returns:
              An inner joined DataFrame.
          """
          frame = {
              key: value._values[left_index]
              for key, value in df.items()
          }
          r_frame = {
              key: value._values[right_index]
              for key, value in right.items()
          }
          frame.update(r_frame)
          if indicator:
              indicator, arr = _add_indicator(
                  indicator=indicator,
                  how="inner",
                  column_length=left_index.size,
                  columns=df.columns.union(right.columns),
              )
              frame[indicator] = arr
          return pd.DataFrame(frame, copy=False)
  
      if how == "inner":
          return _inner(df, right, left_index, right_index, indicator)
  
      if how != "outer":
          if indicator:
              columns = df.columns.union(right.columns)
          if how == "left":
              right = {
                  key: value._values[right_index]
                  for key, value in right.items()
              }
              if indicator:
                  indicator, arr = _add_indicator(
                      indicator=indicator,
                      how="inner",
                      column_length=right_index.size,
                      columns=columns,
                  )
                  right[indicator] = arr
              right = pd.DataFrame(right, index=left_index, copy=False)
          else:
              df = {
                  key: value._values[left_index]
                  for key, value in df.items()
              }
              if indicator:
                  indicator, arr = _add_indicator(
                      indicator=indicator,
                      how="inner",
                      column_length=left_index.size,
                      columns=columns,
                  )
                  df[indicator] = arr
              df = pd.DataFrame(df, index=right_index, copy=False)
          df, right = df.align(other=right, join=how, axis=0)
          if indicator:
              if (how == "left") and right[indicator].hasnans:
                  right[indicator] = right[indicator].fillna(
                      "left_only"
                  )
              elif (how == "right") and df[indicator].hasnans:
                  df[indicator] = df[indicator].fillna("right_only")
          indexer = range(len(df))
          df.index = indexer
          right.index = indexer
  
          return pd.concat([df, right], axis=1, sort=False, copy=False)
  
      both = _inner(df, right, left_index, right_index, indicator)
      contents = []
      columns = df.columns.union(right.columns)
      left_index = np.setdiff1d(df.index, left_index)
      if left_index.size:
          df = df.take(left_index)
          if indicator:
              l_indicator, arr = _add_indicator(
                  indicator=indicator,
                  how="left",
                  column_length=left_index.size,
                  columns=columns,
              )
              df[l_indicator] = arr
          contents.append(df)
  
      contents.append(both)
  
      right_index = np.setdiff1d(right.index, right_index)
      if right_index.size:
          right = right.take(right_index)
          if indicator:
              r_indicator, arr = _add_indicator(
                  indicator=indicator,
                  how="right",
                  column_length=right_index.size,
                  columns=columns,
              )
              right[r_indicator] = arr
          contents.append(right)
  
      return pd.concat(
          contents, axis=0, copy=False, sort=False, ignore_index=True
      )
  
imports: from __future__ import annotations
  import operator
  import warnings
  from typing import Any, Hashable, Literal, Optional, Union
  import numpy
  import pandas
  import pandas_flavor
  from pandas.api.types import is_datetime64_dtype, is_dtype_equal, is_extension_array_dtype, is_numeric_dtype, is_timedelta64_dtype
  from pandas.core.reshape.merge import _MergeOperation
  from janitor.functions.utils import _generic_func_cond_join, _JoinOperator, _keep_output, col, greater_than_join_types, less_than_join_types
  from janitor.utils import check, check_column, find_stack_level
label_desc: Use image node_id 12 for calling a global function with example usage: _create_frame(df, right, left_index, right_index, how, df_columns, right_columns, indicator) and returns: pd, indicator,  arr, pd, _inner, pd