'Update all the configured hidden services from a dictionary having
the same format as
:func:`~stem.control.Controller.get_hidden_service_conf`.
For convenience the HiddenServicePort entries can be an integer, string, or
tuple. If an **int** then we treat it as just a port. If a **str** we pass
that directly as the HiddenServicePort. And finally, if a **tuple** then
it\'s expected to be the **(port, target_address, target_port)** as provided
by :func:`~stem.control.Controller.get_hidden_service_conf`.
This is to say the following three are equivalent...
"HiddenServicePort": [
80,
\'80 127.0.0.1:80\',
(80, \'127.0.0.1\', 80),
.. versionadded:: 1.3.0
:param dict conf: configuration dictionary
:raises:
* :class:`stem.ControllerError` if the call fails
* :class:`stem.InvalidArguments` if configuration options
requested was invalid
* :class:`stem.InvalidRequest` if the configuration setting is
impossible or if there\'s a syntax error in the configuration values'

def set_hidden_service_conf(self, conf):

    if (not conf):
        self.reset_conf('HiddenServiceDir')
        return
    hidden_service_options = []
    for directory in conf:
        hidden_service_options.append(('HiddenServiceDir', directory))
        for (k, v) in list(conf[directory].items()):
            if (k == 'HiddenServicePort'):
                for entry in v:
                    if isinstance(entry, int):
                        entry = ('%s    127.0.0.1:%s' % (entry, entry))
                    elif isinstance(entry, str):
                        pass
                    elif isinstance(entry, tuple):
                        (port, target_address, target_port) = entry
                        entry = ('%s    %s:%s' % (port, target_address, target_port))
                    hidden_service_options.append(('HiddenServicePort', entry))
            else:
                hidden_service_options.append((k, str(v)))
    self.set_options(hidden_service_options)
