code: def restrict_input_to_index(df_or_dict, column_id, index):
      """
      Restrict df_or_dict to those ids contained in index.
  
      :param df_or_dict: a pandas DataFrame or a dictionary.
      :type df_or_dict: pandas.DataFrame or dict
      :param column_id: it must be present in the pandas DataFrame or in all DataFrames in the dictionary.
          It is not allowed to have NaN values in this column.
      :type column_id: basestring
      :param index: Index containing the ids
      :type index: Iterable or pandas.Series
  
      :return df_or_dict_restricted: the restricted df_or_dict
      :rtype df_or_dict_restricted: dict or pandas.DataFrame
      :raise: ``TypeError`` if df_or_dict is not of type dict or pandas.DataFrame
      """
      if isinstance(df_or_dict, pd.DataFrame):
          ids_in_df = set(df_or_dict[column_id])
          ids_in_index = set(index)
          present_ids = ids_in_index & ids_in_df
          if not present_ids:
              msg = "The ids of the time series container and the index of the input data X do not share any identifier!"
              raise AttributeError(msg)
  
          df_or_dict_restricted = df_or_dict[
              df_or_dict[column_id].isin(index)
          ]
      elif isinstance(df_or_dict, dict):
          df_or_dict_restricted = {
              kind: restrict_input_to_index(df, column_id, index)
              for kind, df in df_or_dict.items()
          }
      else:
          raise TypeError(
              "df_or_dict should be of type dict or pandas.DataFrame"
          )
  
      return df_or_dict_restricted
  
file_path: tsfresh/tsfresh/utilities/dataframe_functions.py
imports: import warnings
  import numpy
  import pandas
  from tsfresh import defaults
  from tsfresh.utilities.distribution import DistributorBaseClass, MapDistributor, MultiprocessingDistributor
label_desc: Use image node_id 6 for calling a global function with example usage: restrict_input_to_index(df_or_dict, column_id, index) and returns: df_or_dict_restricted