def setup_config(config_dir):
    """ Setup configuration directory. """
    config_dir = os.path.abspath(config_dir)
    if not os.path.isdir(config_dir):
        try:
            os.mkdir(config_dir)
        except OSError as err:
            print('Polyglot could not create configuration directory.')
            print(repr(err))
            sys.exit(1)
    if not os.path.isdir(os.path.join(config_dir, 'node_servers')):
        try:
            os.mkdir(os.path.join(config_dir, 'node_servers'))
        except __HOLE__ as err:
            print('Polyglot could not create user node server directory.')
            print(repr(err))
            sys.exit(1)
    return config_dir
dataset/ETHPy150Open UniversalDevicesInc/Polyglot/polyglot/__main__.py/setup_config