code: function getMasterInstance(instances) {
          let instanceId;
  
          const instanceIds = Object.keys(instances);
          for (let i = 0; i < instanceIds.length; i++) {
              instanceId = instanceIds[i];
              if (instances[instanceId].isMaster) {
                  return {
                      id: instanceId,
                      instance: instances[instanceId]
                  };
              }
          }
          return null;
      }
docs: Gets the instance marked as master
  
  @param {Object} instances - Instances map
  
  @returns {Object} master instance if one is found
  
  {
  id: instance_id,
  instance: instance_data
  }