def __type2str(type_, buf, _, tbl):
del buf[:]<EOL>if type_ in tbl:<EOL><INDENT>buf.extend(tbl[type_].encode('<STR_LIT:ascii>'))<EOL><DEDENT>else:<EOL><INDENT>buf.extend('<STR_LIT>'.format(type_).encode('<STR_LIT:ascii>'))<EOL><DEDENT>return buf<EOL>
https://github.com/thom311/libnl/blob/libnl3_2_25/lib/utils.c#L968.

    Positional arguments:
    type_ -- integer, key to lookup in `tbl`.
    buf -- bytearray().
    _ -- unused.
    tbl -- dict.

    Returns:
    Reference to `buf`.