### Summary

I am trying to isolate a lookup call with multiple parameters (hashi_vault, for example) into a Jinja2 macro in a sepate file to be used later in multiple high-level templates. Template containing a call to this kind of imported macro is not rendered, instead an error `argument of type 'NoneType' is not iterable` is thrown.

As long as I move the macro from a separate file to the high-level template itself, the template is rendered correctly. If the macro is not called, the template is also rendered correctly. If macro does not contain a lookup call, the template is also rendered correctly.

Issue seems not to be dependent on a specific lookup.

### Issue Type

Bug Report

### Component Name

template

### Ansible Version

```console
$ ansible --version
ansible 2.9.16
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Aug 13 2020, 02:51:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
```


### Configuration

```console
$ ansible-config dump --only-changed
DEFAULT_HOST_LIST(env: ANSIBLE_INVENTORY) = [u'/home/user/aes_infra/debug/hosts']
RETRY_FILES_ENABLED(/etc/ansible/ansible.cfg) = False
```


### OS / Environment

RHEL 7.9

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
playbook.yml:
```yaml (paste below)
- hosts: localhost
  tasks:
   - template:
       src: template_with_included_macro.j2
       dest: /tmp/something
```

template_with_included_macro.j2:
```yaml (paste below)
{% from 'some_macro.j2' import some_fn as some_fn %}
{{ some_fn('some parameter value') }}
```

some_macro.j2:
```yaml (paste below)
{% macro some_fn(some_value) -%}
{{ some_value }}: {{ lookup('lines', 'date') }}
{%- endmacro %}

```

### Expected Results

/tmp/something is created containing a line similar to:
`some parameter value: Fri Jul 30 19:52:01 MSK 2021`

### Actual Results

```console
ansible-playbook playbook.yml -vvvv
ansible-playbook 2.9.16
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.5 (default, Aug 13 2020, 02:51:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/user/aes_infra/debug/hosts as it did not pass its verify_file() method
script declined parsing /home/user/aes_infra/debug/hosts as it did not pass its verify_file() method
auto declined parsing /home/user/aes_infra/debug/hosts as it did not pass its verify_file() method
Parsed /home/user/aes_infra/debug/hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/site-packages/ansible/plugins/callback/default.pyc
Skipping callback 'actionable', as we already have a stdout callback.
Skipping callback 'counter_enabled', as we already have a stdout callback.
Skipping callback 'debug', as we already have a stdout callback.
Skipping callback 'dense', as we already have a stdout callback.
Skipping callback 'dense', as we already have a stdout callback.
Skipping callback 'full_skip', as we already have a stdout callback.
Skipping callback 'json', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'null', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
Skipping callback 'selective', as we already have a stdout callback.
Skipping callback 'skippy', as we already have a stdout callback.
Skipping callback 'stderr', as we already have a stdout callback.
Skipping callback 'unixy', as we already have a stdout callback.
Skipping callback 'yaml', as we already have a stdout callback.

PLAYBOOK: playbook.yml ***************************************************************************************************************************************************************************************************************************************************************************
Positional arguments: playbook.yml
become_method: sudo
inventory: (u'/home/user/aes_infra/debug/hosts',)
forks: 5
tags: (u'all',)
verbosity: 4
connection: smart
timeout: 10
1 plays in playbook.yml

PLAY [localhost] *********************************************************************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************************************************************************************
task path: /home/user/aes_infra/debug/playbook.yml:1
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: user
<127.0.0.1> EXEC /bin/sh -c 'echo ~user && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/user/.ansible/tmp `"&& mkdir "` echo /home/user/.ansible/tmp/ansible-tmp-1627663950.49-10712-11567199494796 `" && echo ansible-tmp-1627663950.49-10712-11567199494796="` echo /home/user/.ansible/tmp/ansible-tmp-1627663950.49-10712-11567199494796 `" ) && sleep 0'
Using module file /usr/lib/python2.7/site-packages/ansible/modules/system/setup.py
<127.0.0.1> PUT /home/user/.ansible/tmp/ansible-local-10703AtxaSw/tmp6TEQtq TO /home/user/.ansible/tmp/ansible-tmp-1627663950.49-10712-11567199494796/AnsiballZ_setup.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/user/.ansible/tmp/ansible-tmp-1627663950.49-10712-11567199494796/ /home/user/.ansible/tmp/ansible-tmp-1627663950.49-10712-11567199494796/AnsiballZ_setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python2 /home/user/.ansible/tmp/ansible-tmp-1627663950.49-10712-11567199494796/AnsiballZ_setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/user/.ansible/tmp/ansible-tmp-1627663950.49-10712-11567199494796/ > /dev/null 2>&1 && sleep 0'
ok: [localhost]
META: ran handlers

TASK [template] **********************************************************************************************************************************************************************************************************************************************************************************
task path: /home/user/aes_infra/debug/playbook.yml:3
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: user
<127.0.0.1> EXEC /bin/sh -c 'echo ~user && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/user/.ansible/tmp `"&& mkdir "` echo /home/user/.ansible/tmp/ansible-tmp-1627663951.84-10780-154162593862092 `" && echo ansible-tmp-1627663951.84-10780-154162593862092="` echo /home/user/.ansible/tmp/ansible-tmp-1627663951.84-10780-154162593862092 `" ) && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/user/.ansible/tmp/ansible-tmp-1627663951.84-10780-154162593862092/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
    "changed": false,
    "msg": "AnsibleError: Unexpected templating type error occurred on ({% from 'some_macro.j2' import some_fn as some_fn %}\r\n{{ some_fn('some parameter value') }}\r\n): argument of type 'NoneType' is not iterable"
}

PLAY RECAP ***************************************************************************************************************************************************************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
#
#
#
#
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import jinja2
__all__ = ['AnsibleJ2Template']
class AnsibleJ2Template(jinja2.environment.Template):
    '''
    A helper class, which prevents Jinja2 from running AnsibleJ2Vars through dict().
    Without this, {% include %} and similar will create new contexts unlike the special
    one created in Templar.template. This ensures they are all alike, except for
    potential locals.
    '''
    def new_context(self, vars=None, shared=False, locals=None):
        if vars is not None:
            if isinstance(vars, dict):
                vars = vars.copy()
                if locals is not None:
                    vars.update(locals)
            else:
                vars = vars.add_locals(locals)
        return self.environment.context_class(self.environment, vars, self.name, self.blocks)