'Set up the environment like it would have been when this
function was first defined.
Child step engine \'implementations\' must have \'return locals()\'
at end end of their steps.  Because of this, we can call the
parent function and get back all child functions (i.e. those
defined within it).
Unfortunately, the call stack of the function calling
job.next_step might have been deeper than the function it
added.  In order to make sure that the environment is what it
should be, we need to then pop off the frames we built until
we find the frame where the function was first defined.'

def _create_frame(self, global_vars, ancestry, fn_name):

    current_frame = copy.copy(global_vars)
    frames = [current_frame]
    for steps_fn_name in ancestry:
        ret = self._run_step_fn(current_frame, steps_fn_name, [], {})
        current_frame = copy.copy(ret)
        frames.append(current_frame)
    while (len(frames) > 2):
        if (fn_name not in frames[(-2)]):
            break
        if (frames[(-2)][fn_name] != frames[(-1)][fn_name]):
            break
        frames.pop()
        ancestry.pop()
    return (frames[(-1)], ancestry)
