code: def _find_all_variables(
      X: pd.DataFrame,
      variables: Variables = None,
      exclude_datetime: bool = False,
  ) -> List[Union[str, int]]:
      """
      If variables are None, captures all variables in the dataframe in a list.
      If user enters variable names in list, it returns the list.
  
      Parameters
      ----------
      X :  pandas DataFrame
      variables : List of variables. Defaults to None.
  
      Raises
      ------
      TypeError
          If the variable list provided by the user contains variables not present in the
          dataframe.
  
      Returns
      -------
      variables : List of numerical variables
      """
      # find all variables in dataset
      if variables is None:
          if exclude_datetime is True:
              variables_ = X.select_dtypes(
                  exclude="datetime"
              ).columns.to_list()
          else:
              variables_ = X.columns.to_list()
  
      elif isinstance(variables, (str, int)):
          if variables not in X.columns.to_list():
              raise ValueError("The variable is not in the dataframe.")
          variables_ = [variables]
  
      else:
          if len(variables) == 0:
              raise ValueError("The list of variables is empty.")
  
          if any(f for f in variables if f not in X.columns):
              raise KeyError(
                  "Some of the variables are not in the dataframe."
              )
  
          variables_ = variables
  
      return 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 4 for calling a global function with example usage: _find_all_variables(X, variables, exclude_datetime) and returns: variables_