def __getattr__(self, attr):
tag = attr[:-<NUM_LIT:1>]<EOL>if attr in self.allowed_attrs:<EOL><INDENT>if isinstance(self.source, str):<EOL><INDENT>return self.source<EOL><DEDENT>return getattr(self.source, attr, '<STR_LIT>')<EOL><DEDENT>if attr in self.valid_tags:<EOL><INDENT>return next(filter(lambda t: t.source.name == attr, self.branches), None)<EOL><DEDENT>if attr[-<NUM_LIT:1>] == '<STR_LIT:s>' and tag in self.valid_tags:<EOL><INDENT>condition = lambda t: t.source.name == tag<EOL>return filter(condition, self.branches)<EOL><DEDENT>raise AttributeError("<STR_LIT>" % attr)<EOL>
Check source for attributes