def check_new_policy(policy):
    """
    Checks the validity of a single policy using the rules from
    part 2 of day 2.
    """
    result = dict(policy)
    letter_pos1 = policy["passwd"][policy["low"]-1]
    letter_pos2 = policy["passwd"][policy["high"]-1]

    result["valid"] = ( letter_pos1 == policy["letter"] \
                        or letter_pos2 == policy["letter"] ) \
                        and not letter_pos1 == letter_pos2

    return result