def ast_from_class(self, klass, modname=None):
if modname is None:<EOL><INDENT>try:<EOL><INDENT>modname = klass.__module__<EOL><DEDENT>except AttributeError as exc:<EOL><INDENT>raise exceptions.AstroidBuildingError(<EOL>"<STR_LIT>",<EOL>cls=klass,<EOL>class_repr=safe_repr(klass),<EOL>modname=modname,<EOL>) from exc<EOL><DEDENT><DEDENT>modastroid = self.ast_from_module_name(modname)<EOL>return modastroid.getattr(klass.__name__)[<NUM_LIT:0>]<EOL>
get astroid for the given class