def filterTokensWords(tokens, accepted=None, rejected=None):
    """
        Filter a list of tokens depending on their tag.

        :param tokens: List of tagged tokens
        :type tokens: [(String, String)]
        :param accepted: List of tokens to keep. All if None.
        :type accepted: [String]
        :param rejected: List of tokens to reject. None if None.
        :type rejected: [String]

        :return: List of non-rejected tokens
        :rtype: [(String, String)]
    """
    if accepted is not None:
        tokens = [(i, j) for i, j in tokens if j in accepted]

    if rejected is not None:
        tokens = [(i, j) for i, j in tokens if j not in rejected]

    return tokens