def decode_string(tstr, detok):
    """Decodes a single token.

    Args:
        tstr        - encoded input string
        detok       - detokenizer

    Return:
        decoded string or None
    """
    try:
        t = bytes.fromhex(tstr)
        s = str(detok.detokenize(t))

        if s.find('$') == 0:
            return None
        return s
    except:
        return None