<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_key_from_envs(envs, key):
 """Return the value of a key from the given dict respecting namespaces. Data can also be a list of data dicts. """

    # if it barks like a dict, make it a list have to use `get` since dicts and
    # lists both have __getitem__
    if hasattr(envs, 'get'):
        envs = [envs]

    for env in envs:
        if key in env:
            return env[key]

    return NO_VALUE