def get_input_words(word_counts, reserved_tokens, max_token_length):
    """Filters out words that are longer than max_token_length or are reserved.

    Args:
      word_counts: list of (string, int) tuples
      reserved_tokens: list of strings
      max_token_length: int, maximum length of a token

    Returns:
      list of (string, int) tuples of filtered wordcounts
    """

    all_counts = []

    for word, count in word_counts:
        if len(word) > max_token_length or word in reserved_tokens:
            continue
        all_counts.append((word, count))

    return all_counts