docs: def parse_file_entities(filename, 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
          entities (list): An optional list of Entity instances to use in
              extraction. If passed, the config argument is ignored.
          config (str, Config, list): One or more Config objects or names of
              configurations to use in matching. Each element must be a Config
              object, or a valid Config name (e.g., 'bids' or 'derivatives').
              If None, all available configs are used.
          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.
      """
  
      # Load Configs if needed
      if entities is None:
  
          if config is None:
              config = ['bids', 'derivatives']
  
          config = [Config.load(c) if not isinstance(c, Config) else c
                    for c in listify(config)]
  
          # Consolidate entities from all Configs into a single dict
          entities = {}
          for c in config:
              entities.update(c.entities)
          entities = entities.values()
  
      # Extract matches
      bf = BIDSFile(filename)
      ent_vals = {}
      for ent in entities:
          match = ent.match_file(bf)
          if match is not None or include_unmatched:
              ent_vals[ent.name] = match
  
      return ent_vals