(encoder, datum, schema, named_schemas, fname)
Write a datum of data to output stream.

    Parameters
    ----------
    encoder: encoder
        Type of encoder (e.g. binary or json)
    datum: object
        Data to write
    schema: dict
        Schema to use
    named_schemas: dict
        Mapping of fullname to schema definition
Write a datum of data to output stream.
Write a datum of data to output stream .
def write_data(encoder, datum, schema, named_schemas, fname):
    """Write a datum of data to output stream.

    Parameters
    ----------
    encoder: encoder
        Type of encoder (e.g. binary or json)
    datum: object
        Data to write
    schema: dict
        Schema to use
    named_schemas: dict
        Mapping of fullname to schema definition
    """

    record_type = extract_record_type(schema)
    logical_type = extract_logical_type(schema)

    fn = WRITERS.get(record_type)
    if fn:
        if logical_type:
            prepare = LOGICAL_WRITERS.get(logical_type)
            if prepare:
                datum = prepare(datum, schema)
        try:
            return fn(encoder, datum, schema, named_schemas, fname)
        except TypeError as ex:
            if fname:
                raise TypeError(f"{ex} on field {fname}")
            raise
    else:
        return write_data(encoder, datum, named_schemas[record_type], named_schemas, "")
def write_data ( encoder , datum , schema , named_schemas , fname ) : record_type = extract_record_type ( schema ) logical_type = extract_logical_type ( schema ) fn = WRITERS . get ( record_type ) if fn : if logical_type : prepare = LOGICAL_WRITERS . get ( logical_type ) if prepare : datum = prepare ( datum , schema ) try : return fn ( encoder , datum , schema , named_schemas , fname ) except TypeError as ex : if fname : raise TypeError ( f"{ex} on field {fname}" ) raise else : return write_data ( encoder , datum , named_schemas [ record_type ] , named_schemas , "" )