code: def assert_correct_format(estimators, preprocessing):
      """Initial check to assert layer can be constructed."""
      if (preprocessing is None) or (
          not isinstance(preprocessing, dict)
      ):
          if isinstance(estimators, dict):
              # Either no or uniform preprocessing, estimators should be list
              msg = (
                  "Preprocessing is either 'None' or 'list': 'estimators' "
                  "must be of type 'list'. Got %s."
              )
              raise LayerSpecificationError(msg % type(estimators))
      else:
          # Check that both estimators and preprocessing are dicts
          if not isinstance(preprocessing, dict):
              msg = (
                  "Unexpected format of 'preprocessing'. Needs to be "
                  " of type 'None' or 'list' or 'dict'. Got %s ."
              )
              raise LayerSpecificationError(msg % type(preprocessing))
  
          if not isinstance(estimators, dict):
              msg = (
                  "Unexpected format of 'estimators'. Needs to be "
                  "'dict' when preprocessing is 'dict'. Got %s."
              )
              raise LayerSpecificationError(msg % type(estimators))
  
          # Check that keys overlap
          prep_check = [key in preprocessing for key in estimators]
          est_check = [key in estimators for key in preprocessing]
  
          if not all(est_check):
              msg = (
                  "Too few estimator cases to match preprocessing cases:\n"
                  "estimator cases:     %r\npreprocessing cases: %r"
              )
              raise LayerSpecificationError(
                  msg % (list(estimators), list(preprocessing))
              )
          if not all(prep_check):
              msg = (
                  "Too few preprocessing cases to match estimators cases:\n"
                  "preprocessing cases: %r\nestimator cases:     %r"
              )
              raise LayerSpecificationError(
                  msg % (list(preprocessing), list(estimators))
              )
  
imports: import warnings
  from .exceptions import NotFittedError, LayerSpecificationWarning, LayerSpecificationError, ParallelProcessingError, ParallelProcessingWarning
label_desc: Use image node_id 5 for calling a global function with example usage: assert_correct_format(estimators, preprocessing) without return types