#NEWLINE# def get_operation_ast( document_ast , operation_name = None ) : #NEWLINE# #INDENT# operation = None #NEWLINE# for definition in document_ast . definitions : #NEWLINE# #INDENT# if isinstance ( definition , ast . OperationDefinition ) : #NEWLINE# #INDENT# if ( not operation_name ) : #NEWLINE# #INDENT# if operation : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# operation = definition #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( operation_name . name and ( definition . name . value == operation_name ) ) : #NEWLINE# #INDENT# return definition #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return operation