<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def load_from_file(self, yamlfile, _override=True, _allow_undeclared=False):
 """Loads the configuration from a file. Parsed contents must be a single dict mapping config key to value. Args: yamlfile: The opened file object to load configuration from. See load_from_dict() for other args' descriptions. Raises: ConfigurationInvalidError: If configuration file can't be read, or can't be parsed as either YAML (or JSON, which is a subset of YAML). """

    self._logger.info('Loading configuration from file: %s', yamlfile)

    try:
      parsed_yaml = self._modules['yaml'].safe_load(yamlfile.read())
    except self._modules['yaml'].YAMLError:
      self._logger.exception('Problem parsing YAML')
      raise self.ConfigurationInvalidError(
          'Failed to load from %s as YAML' % yamlfile)

    if not isinstance(parsed_yaml, dict):
      # Parsed YAML, but it's not a dict.
      raise self.ConfigurationInvalidError(
          'YAML parsed, but wrong type, should be dict', parsed_yaml)

    self._logger.debug('Configuration loaded from file: %s', parsed_yaml)
    self.load_from_dict(
        parsed_yaml, _override=_override, _allow_undeclared=_allow_undeclared)