Attempts to read the contents of the given configuration file.
        :param path: Path to a configuration file.
        :raises: ConfigParseError if file does not exist or cannot be read.
        :return: Dictionary of configuration data.

def _read_file_data(self, path):
        """
        Attempts to read the contents of the given configuration file.
        :param path: Path to a configuration file.
        :raises: ConfigParseError if file does not exist or cannot be read.
        :return: Dictionary of configuration data.
        """
        _, ext = os.path.splitext(path)
        # YAML files
        if ext in ('.yml', '.yaml'):
            try:
                with open(path) as f:
                    return yaml.safe_load(f)
            except YAMLError as e:
                raise ConfigParseError(path, e)
        # JSON files
        elif ext == '.json':
            try:
                return json.loads(open(path).read())
            except ValueError as e:
                raise ConfigParseError(path, e)
        else:
            raise ConfigParseError(path, TypeError("Unsupported file type {}".format(ext)))