def filter_sentence_length(sentence_pairs, max_length):
    """Filters sentence pairs by max length.

    Args:
        sentence_pairs (list): list of pairs of sentences.
        max_length (int): max words num in each sentence.

    Returns:
      filter_result (list): filtered sentence pairs.
    """
    filter_result = [[src, tgt] for src, tgt in sentence_pairs
                     if len(src.split(" ")) < max_length and
                     len(tgt.split(" ")) < max_length]
    return filter_result