code: def _pivot_longer_names_sep(
      df: pd.DataFrame,
      index: Union[dict, None],
      names_to: list,
      names_sep: Union[str, Pattern],
      values_to: str,
      names_transform: bool,
      dropna: bool,
      sort_by_appearance: bool,
      ignore_index: bool,
  ) -> pd.DataFrame:
      """
      This takes care of pivoting scenarios where
      names_sep is provided.
      """
  
      mapping = pd.Series(df.columns).str.split(names_sep, expand=True)
      len_mapping_columns = len(mapping.columns)
      len_names_to = len(names_to)
  
      if len_names_to != len_mapping_columns:
          raise ValueError(
              f"The length of names_to does not match "
              "the number of levels extracted. "
              f"The length of names_to is {len_names_to} "
              "while the number of levels extracted is "
              f"{len_mapping_columns}."
          )
  
      mapping.columns = names_to
  
      if ".value" not in names_to:
          if len(names_to) == 1:
              df.columns = mapping.iloc[:, 0]
          else:
              df.columns = pd.MultiIndex.from_frame(mapping)
          return _base_melt(
              df=df,
              index=index,
              values_to=values_to,
              names_transform=names_transform,
              dropna=dropna,
              sort_by_appearance=sort_by_appearance,
              ignore_index=ignore_index,
          )
  
      return _pivot_longer_dot_value(
          df=df,
          index=index,
          sort_by_appearance=sort_by_appearance,
          ignore_index=ignore_index,
          names_to=names_to,
          dropna=dropna,
          names_transform=names_transform,
          mapping=mapping,
      )
  
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 6 for calling a global function with example usage: _pivot_longer_names_sep(df, index, names_to, names_sep, values_to, names_transform, dropna, sort_by_appearance, ignore_index) and returns: _pivot_longer_dot_value, _base_melt