code: def _space_soft_contains(space, element):
      """Check that a space has the same dimensionality as an element.
  
      If the space's dimensionality is not available, check that the space
      contains the element.
  
      Args:
          space (akro.Space or gym.Space): Space to check
          element (object): Element to check in space.
  
      Returns:
          bool: True iff the element was "matched" the space.
      """
      if space.contains(element):
          return True
      elif hasattr(space, "flat_dim"):
          return space.flat_dim == np.prod(element.shape)
      else:
          return False
  
imports: from dataclasses import dataclass
  import enum
  from typing import Dict, List
  import warnings
  import numpy
  from garage.np import concat_tensor_dict_list, pad_batch_array, slice_nested_dict, stack_tensor_dict_list
label_desc: Use image node_id 1 for calling a global function with example usage: _space_soft_contains(space, element) and returns: True, unknown, False