code: def _filter_out_variables_not_in_dataframe(X, variables):
      """Filter out variables that are not present in the dataframe.
  
      Function removes variables that the user defines in the argument `variables`
      but that are not present in the input dataframe.
  
      Useful when using several feature selection procedures in a row. The dataframe
      input to the first selection algorithm likely contains more variables than the
      input dataframe to subsequent selection algorithms, and it is not possible a
      priori, to say which variable will be dropped.
  
      Parameters
      ----------
      X:  pandas DataFrame
      variables: string, int or list of (strings or int).
  
      Returns
      -------
      filtered_variables: List of variables present in `variables` and in the
          input dataframe.
      """
      # When variables is not defined, keep it like this and return None.
      if variables is None:
          return None
  
      # If an integer or a string is provided, convert to a list.
      if not isinstance(variables, list):
          variables = [variables]
  
      # Filter out elements of variables that are not in the dataframe.
      filtered_variables = [
          var for var in variables if var in X.columns
      ]
  
      # Raise an error if no column is left to work with.
      if len(filtered_variables) == 0:
          raise ValueError(
              "After filtering no variable remaining. At least 1 is required."
          )
  
      return filtered_variables
  
file_path: feature_engine/feature_engine/_variable_handling/variable_type_selection.py
imports: from typing import List, Tuple, Union
  import pandas
  from pandas.api.types import is_categorical_dtype
  from pandas.api.types import is_datetime64_any_dtype
  from pandas.api.types import is_numeric_dtype
  from pandas.api.types import is_object_dtype
  from feature_engine._variable_handling.variable_type_checks import _is_categorical_and_is_datetime, _is_categorical_and_is_not_datetime
label_desc: Use image node_id 5 for calling a global function with example usage: _filter_out_variables_not_in_dataframe(X, variables) and returns: filtered_variables, None