docs: 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):
          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: df[df[column_id].isin(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