def get_null_term_str(data, encoding):
    """
    extract null terminated string from data
    :param data: data buffer
    :param encoding: encoding used to convert bytes to str
    :return: string
    """
    # temp = data[:]
    if 0 in data:
        temp = bytes(data[:data.index(0)])
    else:
        temp = bytes(data)
    return temp.decode(encoding)