code: public String get_host_name(final Connection connection) throws DevFailed {
          if (connection.url.use_db) {
              Database db;
              if (connection.url.host == null) {
                  db = ApiUtil.get_db_obj();
              } else {
                  db = ApiUtil.get_db_obj(connection.url.host, connection.url.strPort);
              }
              final DbDevImportInfo info = db.import_device(connection.devname);
              return info.hostname;
          }
          else {
              return connection.url.host;
          }
      }
docs: ===================================================================