code: def load_map(stream, name=None, check_integrity=True, check_duplicates=True):
      
      map_dict = yaml.safe_load(stream)
      if isinstance(map_dict, dict):
          map_name = name or map_dict.pop('name', None)
          if not map_name:
              raise ValueError("No map name provided, and none found in YAML stream.")
          return ContainerMap(map_name, map_dict, check_integrity=check_integrity, check_duplicates=check_duplicates)
      raise ValueError("Valid map could not be decoded.")
docs: Loads a ContainerMap configuration from a YAML document stream.
  
      :param stream: YAML stream.
      :type stream: file
      :param name: Name of the ContainerMap. If not provided, will be attempted to read from a ``name`` attribute on the
        document root level.
      :type name: unicode | str
      :param check_integrity: Performs a brief integrity check; default is ``True``.
      :type check_integrity: bool
      :param check_duplicates: Check for duplicate attached volumes during integrity check.
      :type check_duplicates: bool
      :return: A ContainerMap object.
      :rtype: ContainerMap