<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def Lookup(self, name):
 """Get the value associated with a name in the current context. The current context could be an dictionary in a list, or a dictionary outside a list. Args: name: name to lookup, e.g. 'foo' or 'foo.bar.baz' Returns: The value, or self.undefined_str Raises: UndefinedVariable if self.undefined_str is not set """

        if name == '@':
            return self.stack[-1].context
        
        parts = name.split('.')
        value = self._LookUpStack(parts[0])
        
        # Now do simple lookups of the rest of the parts
        for part in parts[1:]:
            try:
                value = value[part]
            except (KeyError, TypeError):  # TypeError for non-dictionaries
                return self._Undefined(part)
        
        return value