def parse_file_entities(self, filename, scope='all', entities=None,
                            config=None, include_unmatched=False):
        ''' Parse the passed filename for entity/value pairs.

        Args:
            filename (str): The filename to parse for entity values
            scope (str, list): The scope of the search space. Indicates which
                BIDSLayouts' entities to extract. See BIDSLayout docstring
                for valid values. By default, extracts all entities
            entities (list): An optional list of Entity instances to use in
                extraction. If passed, the scope and config arguments are
                ignored, and only the Entities in this list are used.
            config (str, Config, list): One or more Config objects, or paths
                to JSON config files on disk, containing the Entity definitions
                to use in extraction. If passed, scope is ignored.
            include_unmatched (bool): If True, unmatched entities are included
                in the returned dict, with values set to None. If False
                (default), unmatched entities are ignored.

        Returns: A dict, where keys are Entity names and values are the
            values extracted from the filename.
        '''

        # If either entities or config is specified, just pass through
        if entities is None and config is None:
            layouts = self._get_layouts_in_scope(scope)
            config = chain(*[list(l.config.values()) for l in layouts])
            config = list(set(config))

        return parse_file_entities(filename, entities, config,
                                   include_unmatched)
Parse the passed filename for entity/value pairs.

        Args:
            filename (str): The filename to parse for entity values
            scope (str, list): The scope of the search space. Indicates which
                BIDSLayouts' entities to extract. See BIDSLayout docstring
                for valid values. By default, extracts all entities
            entities (list): An optional list of Entity instances to use in
                extraction. If passed, the scope and config arguments are
                ignored, and only the Entities in this list are used.
            config (str, Config, list): One or more Config objects, or paths
                to JSON config files on disk, containing the Entity definitions
                to use in extraction. If passed, scope is ignored.
            include_unmatched (bool): If True, unmatched entities are included
                in the returned dict, with values set to None. If False
                (default), unmatched entities are ignored.

        Returns: A dict, where keys are Entity names and values are the
            values extracted from the filename.