'Fetch a port setting from the config file and in case it\'s set to -1 (random), look for a free port
and assign it to this particular setting.'

def _obtain_port(self, section, option):

    settings_port = self.config[section][option]
    path = ((section + '~') + option)
    in_selected_ports = (path in self.selected_ports)
    if (in_selected_ports or (settings_port == (-1))):
        return self._get_random_port(path)
    return settings_port
