def load_config(path: str, dcs_url: Optional[str]) -> Dict[str, Any]:
    """Load configuration file from *path* and optionally override its DCS configuration with *dcs_url*.

    :param path: path to the configuration file.
    :param dcs_url: the DCS URL in the format ``DCS://HOST:PORT/NAMESPACE``, e.g. ``etcd3://random.com:2399/service``.
        If given, override whatever DCS and ``namespace`` that are set in the configuration file. See :func:`parse_dcs`
        for more information.

    :returns: a dictionary representing the configuration.

    :raises:
        :class:`PatroniCtlException`: if *path* does not exist or is not readable.
    """
    if not (os.path.exists(path) and os.access(path, os.R_OK)):
        if path != CONFIG_FILE_PATH:    # bail if non-default config location specified but file not found / readable
            raise PatroniCtlException('Provided config file {0} not existing or no read rights.'
                                      ' Check the -c/--config-file parameter'.format(path))
        else:
            logging.debug('Ignoring configuration file "%s". It does not exists or is not readable.', path)
    else:
        logging.debug('Loading configuration from file %s', path)
    config = Config(path, validator=None).copy()

    dcs_kwargs = parse_dcs(dcs_url) or {}
    if dcs_kwargs:
        for d in DCS_DEFAULTS:
            config.pop(d, None)
        config.update(dcs_kwargs)
    return config
Load configuration file from *path* and optionally override its DCS configuration with *dcs_url*.

    :param path: path to the configuration file.
    :param dcs_url: the DCS URL in the format ``DCS://HOST:PORT/NAMESPACE``, e.g. ``etcd3://random.com:2399/service``.
        If given, override whatever DCS and ``namespace`` that are set in the configuration file. See :func:`parse_dcs`
        for more information.

    :returns: a dictionary representing the configuration.

    :raises:
        :class:`PatroniCtlException`: if *path* does not exist or is not readable.
    
patroni/ctl.py