def extract_api_version_from_code(function):
try:<EOL><INDENT>srccode = inspect.getsource(function)<EOL>try:<EOL><INDENT>ast_tree = ast.parse(srccode)<EOL><DEDENT>except IndentationError:<EOL><INDENT>ast_tree = ast.parse('<STR_LIT>'+srccode)<EOL><DEDENT>api_version_visitor = ApiVersionExtractor()<EOL>api_version_visitor.visit(ast_tree)<EOL>return api_version_visitor.api_version<EOL><DEDENT>except Exception:<EOL><INDENT>raise<EOL><DEDENT>
Will extract from __code__ the API version. Should be use if you use this is an operation group with no constant api_version.