'A union is encoded by first writing a long value indicating
the zero-based position within the union of the schema of its value.
The value is then encoded per the indicated schema within the union.'

def read_union(self, writers_schema, readers_schema, decoder):

    index_of_schema = int(decoder.read_long())
    if (index_of_schema >= len(writers_schema.schemas)):
        fail_msg = ("Can't    access    branch    index    %d    for    union    with    %d    branches" % (index_of_schema, len(writers_schema.schemas)))
        raise SchemaResolutionException(fail_msg, writers_schema, readers_schema)
    selected_writers_schema = writers_schema.schemas[index_of_schema]
    return self.read_data(selected_writers_schema, readers_schema, decoder)
