def rget(obj, attrstr, default=None, delim='<STR_LIT:.>'):  
try:<EOL><INDENT>parts = attrstr.split(delim, <NUM_LIT:1>)<EOL>attr = parts[<NUM_LIT:0>]<EOL>attrstr = parts[<NUM_LIT:1>] if len(parts) == <NUM_LIT:2> else None<EOL>if isinstance(obj, dict):<EOL><INDENT>value = obj[attr]<EOL><DEDENT>elif isinstance(obj, list):<EOL><INDENT>value = obj[int(attr)]<EOL><DEDENT>elif isinstance(obj, tuple):<EOL><INDENT>value = obj[int(attr)]<EOL><DEDENT>elif isinstance(obj, object):<EOL><INDENT>value = getattr(obj, attr)<EOL><DEDENT>if attrstr:<EOL><INDENT>return rget(value, attrstr, default, delim)<EOL><DEDENT>return value<EOL><DEDENT>except:  <EOL><INDENT>return default<EOL><DEDENT>
Returns the value at the specified attrstr location within a nexted tree of
        dicts, lists, tuples, functions, classes, etc. The lookup is done recursivley
        for each key in attrstr (split by by the delimiter) This function is heavily
        influenced by the lookups used in Django templates.

        Parameters:
            obj (any): Object to start the lookup in (dict, obj, list, tuple, etc).
            attrstr (str): String to lookup (ex: 'foo.bar.baz.value')
            default (any): Default value to return if not found.
            delim (str): Delimiter separating keys in attrstr.