##### SUMMARY
An invalid syntax within a jinja2 statement results in the statement being returned instead of an syntax error.

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
jinja2

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes -->
```paste below
ansible 2.9.0.dev0
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/PycharmProjects/ansible-2/lib/ansible
  executable location = /home/user/PycharmProjects/ansible-2/bin/ansible
  python version = 3.7.3 (default, Mar 26 2019, 21:43:19) [GCC 8.2.1 20181127]
```

##### CONFIGURATION

##### OS / ENVIRONMENT

ArchLinux

##### STEPS TO REPRODUCE

```yaml
- name: Test
  hosts: localhost
  gather_facts: false
  become: false
  strategy: linear
  tasks:
    - debug:
        msg: "{{ foo | ipaddr('address')) }}"
```

##### EXPECTED RESULTS

Syntax error (two closing `)`-characters)

##### ACTUAL RESULTS

```paste below
ok: [localhost] => {
    "msg": "{{ foo | ipaddr('address')) }}"
}
```

@sivel 
'''
    Counts the number of newlines at the end of a string. This is used during
    the jinja2 templating to ensure the count matches the input, since some newlines
    may be thrown away during the templating.
    '''
    try:
        i = len(in_str)
        j = i - 1
        while in_str[j] == '\n':
            j -= 1
        return i - 1 - j
    except IndexError:
        
        return i
def recursive_check_defined(item):
    from jinja2.runtime import Undefined
    if isinstance(item, MutableMapping):
        for key in item:
            recursive_check_defined(item[key])
    elif isinstance(item, list):
        for i in item:
            recursive_check_defined(i)
    else:
        if isinstance(item, Undefined):
            raise AnsibleFilterError("{0} is undefined".format(item))
class AnsibleUndefined(StrictUndefined):