text: """
  Holds functions responsible for models validation across FAT-Forensics.
  """
  # Author: Kacper Sokol <k.sokol@bristol.ac.uk>
  # License: new BSD
  
  import inspect
  import warnings
  
  __all__ = ['check_model_functionality']
  
  
  def check_model_functionality(model_object: object,
                                require_probabilities: bool = False,
                                suppress_warning: bool = False) -> bool:
      """
      Checks whether a model object has all the required functionality.
  
      Examines a ``model_object`` and ensures that it has all the required
      methods with the correct number of parameters (excluding ``self``):
      ``__init__`` (at least 0), ``fit`` (at least 2), ``predict`` (at least 1)
      and, if required (``require_probabilities=True``), ``predict_proba`` (at
      least 1).
  
      Parameters
      ----------
      model_object : object
          A Python object that represents a predictive model.
      require_probabilities : boolean, optional (default=False)
          A boolean parameter that indicates whether the model object should
          contain a ``predict_proba`` method. Defaults to False.
      suppress_warning : boolean, optional (default=False)
          A boolean parameter that indicates whether the function should suppress
          its warning message. Defaults to False.
  
      Warns
      -----
      UserWarning
          Warns about the required functionality that the model object lacks.
  
      Returns
      -------
      is_functional : boolean
          A Boolean variable that indicates whether the model object has all the
          desired functionality.
      """
      is_functional = True
  
      methods = {'fit': 2, 'predict': 1}
      if require_probabilities:
          methods['predict_proba'] = 1
  
      message_strings = []
      for method in methods:
          if not hasattr(model_object, method):
              is_functional = False
              message_strings.append(
                  'The model class is missing \'{}\' method.'.format(method))
          else:
              method_object = getattr(model_object, method)
              required_param_n = 0
              params = inspect.signature(method_object).parameters
              for param in params:
                  if params[param].default is params[param].empty:
                      required_param_n += 1
              if required_param_n != methods[method]:
                  is_functional = False
                  message_strings.append(
                      ('The \'{}\' method of the class has incorrect number '
                       '({}) of the required parameters. It needs to have '
                       'exactly {} required parameters. Try using optional '
                       'parameters if you require more functionality.').format(
                           method, required_param_n, methods[method]))
  
      if not is_functional and not suppress_warning:
          message = '\n'.join(message_strings)
          warnings.warn(message, category=UserWarning)
  
      return is_functional
  