code: def _validate_prepostcmd_hook(cls, func: Callable, data_type: Type) -> None:
          
          signature = inspect.signature(func)
          # validate that the callable has the right number of parameters
          cls._validate_callable_param_count(func, 1)
          # validate the parameter has the right annotation
          paramname = list(signature.parameters.keys())[0]
          param = signature.parameters[paramname]
          if param.annotation != data_type:
              raise TypeError('argument 1 of {} has incompatible type {}, expected {}'.format(
                  func.__name__,
                  param.annotation,
                  data_type,
              ))
          # validate the return value has the right annotation
          if signature.return_annotation == signature.empty:
              raise TypeError('{} does not have a declared return type, expected {}'.format(
                  func.__name__,
                  data_type,
              ))
          if signature.return_annotation != data_type:
              raise TypeError('{} has incompatible return type {}, expected {}'.format(
                  func.__name__,
                  signature.return_annotation,
                  data_type,
              ))
docs: Check parameter and return types for pre and post command hooks.