'Maps are encoded as a series of blocks.
Each block consists of a long count value,
followed by that many key/value pairs.
A block with count zero indicates the end of the map.
Each item is encoded per the map\'s value schema.
If a block\'s count is negative,
then the count is followed immediately by a long block size,
indicating the number of bytes in the block.
The actual count in this case
is the absolute value of the count written.'

def write_map(self, writers_schema, datum, encoder):

    if (len(datum) > 0):
        encoder.write_long(len(datum))
        for (key, val) in datum.items():
            encoder.write_utf8(key)
            self.write_data(writers_schema.values, val, encoder)
    encoder.write_long(0)
