code: def _pivot_longer_dot_value(
      df: pd.DataFrame,
      index: Union[dict, None],
      sort_by_appearance: bool,
      ignore_index: bool,
      names_to: list,
      dropna: bool,
      names_transform: Union[str, Callable, dict, None],
      mapping: pd.DataFrame,
  ) -> pd.DataFrame:
      """
      Pivots the dataframe into the final form,
      for scenarios where names_pattern is a string/regex,
      or names_sep is provided, and .value is in names_to.
  
      Returns a DataFrame.
      """
      if np.count_nonzero(mapping.columns == ".value") > 1:
          outcome = mapping.pop(".value")
          outcome = outcome.sum(axis=1, numeric_only=False)
          mapping.insert(loc=0, column=".value", value=outcome)
  
      exclude = {
          word
          for word in mapping[".value"].array
          if (word in names_to) and (word != ".value")
      }
      if exclude:
          raise ValueError(
              f"Labels {*exclude, } in names_to already exist "
              "in the new dataframe's columns. "
              "Kindly provide unique label(s)."
          )
  
      if index:
          exclude = set(index).intersection(mapping[".value"])
          if exclude:
              raise ValueError(
                  f"Labels {*exclude, } already exist "
                  "as column labels assigned to the dataframe's "
                  "index parameter. Kindly provide unique label(s)."
              )
      if mapping.columns[0] != ".value":
          outcome = mapping.pop(".value")
          mapping.insert(loc=0, column=".value", value=outcome)
  
      if len(mapping.columns) == 1:
          mapping = mapping.iloc[:, 0]
          values, group_max = _headers_single_series(
              df=df, mapping=mapping
          )
          outcome = None
  
      else:
          # For multiple columns, the labels in `.value`
          # should have every value in other
          # and in the same order
          # reindex ensures that, after getting a MultiIndex.from_product
          other = [entry for entry in names_to if entry != ".value"]
          columns = mapping.columns.tolist()
          others = mapping.loc[:, other].drop_duplicates()
          outcome = mapping.loc[:, ".value"].unique()
          if not mapping.duplicated().any(axis=None):
              df.columns = pd.MultiIndex.from_frame(mapping)
              indexer = {".value": outcome, "other": others}
          else:
              columns.append("".join(columns))
              cumcount = mapping.groupby(
                  mapping.columns.tolist(), sort=False, observed=True
              ).cumcount()
              df.columns = [arr for _, arr in mapping.items()] + [
                  cumcount
              ]
              indexer = {
                  ".value": outcome,
                  "other": others,
                  "cumcount": cumcount.unique(),
              }
          indexer = _computations_expand_grid(indexer)
          indexer = pd.DataFrame(indexer, copy=False)
  
          indexer.columns = columns
          df = df.reindex(columns=indexer, copy=False)
          df.columns = df.columns.get_level_values(".value")
          values = _dict_from_grouped_names(df=df)
          outcome = indexer.loc[indexer[".value"] == outcome[0], other]
          group_max = len(outcome)
  
      return _final_frame_longer(
          df=df,
          reps=group_max,
          index=index,
          outcome=outcome,
          values=values,
          names_to=None,
          dropna=dropna,
          names_transform=names_transform,
          sort_by_appearance=sort_by_appearance,
          ignore_index=ignore_index,
      )
  
imports: import re
  import warnings
  from collections import defaultdict
  from itertools import chain, zip_longest
  from typing import Callable, Optional, Pattern, Union
  import numpy
  import pandas
  import pandas_flavor
  from pandas.api.types import is_categorical_dtype, is_extension_array_dtype, is_list_like
  from pandas.core.dtypes.concat import concat_compat
  from janitor.functions.utils import _computations_expand_grid, get_index_labels
  from janitor.utils import check, refactored_function
label_desc: Use image node_id 8 for calling a global function with example usage: _pivot_longer_dot_value(df, index, sort_by_appearance, ignore_index, names_to, dropna, names_transform, mapping) and returns: _final_frame_longer