def truncate_text_by_num_tokens(text, max_tokens, tok_separator=" "):
    """
    Truncate a text to left a maximum number of tokens.

    :param text:
    :param max_tokens:
    :param tok_separator:
    :return: The truncated text.
    """
    _toks = text.split(tok_separator)
    return tok_separator.join(_toks[:min(max_tokens, len(_toks))])