code: def _assert_format(instances, namespace=None):
      """Assert that a generic instances object is correctly formatted."""
      if not namespace:
          namespace = list()
  
      if isinstance(instances, dict):
          # Need to check every instance list across preprocessing cases
          for instance_list in instances.values():
              if not _check_format(instance_list, namespace=namespace):
                  return False
              namespace.extend(n for n, e in instance_list)
          return True
  
      # For list, check the given list
      return _check_format(instances, namespace=namespace)
  
file_path: mlens/mlens/utils/formatting.py
imports: from __future__ import division, print_function
  from collections import Counter
  from .checks import assert_valid_estimator, assert_correct_format
  from .exceptions import LayerSpecificationError
  from ..externals.sklearn.base import clone
label_desc: Use image node_id 4 for calling a global function with example usage: _assert_format(instances, namespace) and returns: _check_format, True, False