human
Complete the below
def dependencies(snippet, path=''):

    ''''Return an iterator over Resource dependencies in a template snippet.
    The snippet should be already parsed to insert Function objects where
    appropriate.'
    '''

Write me a the Python code you requested?
assistant
#Here is the Python code you requested.
    if isinstance(snippet, Function):
        return snippet.dependencies(path)
    elif isinstance(snippet, collections.Mapping):
        def mkpath(key):
            return '.'.join([path, six.text_type(key)])
        deps = (dependencies(value, mkpath(key)) for (key, value) in snippet.items())
        return itertools.chain.from_iterable(deps)
    elif ((not isinstance(snippet, six.string_types)) and isinstance(snippet, collections.Iterable)):
        def mkpath(idx):
            return ''.join([path, ('[%d]' % idx)])
        deps = (dependencies(value, mkpath(i)) for (i, value) in enumerate(snippet))
        return itertools.chain.from_iterable(deps)
    else:
        return []