def METHOD_NAME (tag_name, idata):
    tag = tags.DICT[tag_name]
    tag_type = tags.type_of_tag(tag)
    rest = idata
    if tag_type == types.NODATA:
        data = None
    elif tag_type == types.ASCII:
        data = rest[1:-1].encode() # FIXME
    elif tag_type == types.BITARRAY:
        data = int(rest)
    elif tag_type == types.REAL8:
        data = [float(s) for s in rest.split(',')]
    elif tag_type == types.INT2 or tag_type == types.INT4:
        data = [int(s) for s in rest.split(',')]
    else:
        raise Exception('Unsupported type')
    rec = Record(tag, data)
    rec.save(ofile)