code: @Nullable
    public static ImmutablePair<Schema, Schema> findSchema(Set<Schema> output, Set<Schema> input) {
      ImmutablePair<Schema, Schema> compatibleSchema = null;
  
      for (Schema outputSchema : output) {
        for (Schema inputSchema : input) {
          if (outputSchema.equals(inputSchema)) {
            return new ImmutablePair<Schema, Schema>(inputSchema, outputSchema);
          }
  
          if (outputSchema.isCompatible(inputSchema)) {
            // If there are more than one compatible, then it's a problem
            // we should have only strictly one.
            if (compatibleSchema != null) {
              return null;
            }
            compatibleSchema = new ImmutablePair<Schema, Schema>(outputSchema, inputSchema);
          }
        }
      }
  
      return compatibleSchema;
    }
docs: Finds the right schema to be used for the connections.
  <p>
  A connection should have the following:
  <ul>
  <li>Equal overrides compatible : So if there is equal, we use that</li>
  <li>In case of compatible, we try to find one schema and only one. More than one is a error.</li>
  </ul>
  </p>
  @param output Set of output {@link Schema}.
  @param input  Set of input {@link Schema}.
  @return An {@link ImmutablePair} with first as output schema and second as input schema.