def _find_statement_by_line(node, line):
 if isinstance(node, (nodes.Class, nodes.Function)):
  node_line = node.fromlineno
 else:
  node_line = node.lineno
 if (node_line == line):
  return node
 for child in node.get_children():
  result = _find_statement_by_line(child, line)
  if result:
   return result
 return None

def _find_statement_by_line ( node , line ) : if isinstance ( node , ( nodes . Class , nodes . Function ) ) : node_line = node . fromlineno else : node_line = node . lineno if ( node_line == line ) : return node for child in node . get_children ( ) : result = _find_statement_by_line ( child , line ) if result : return result return None
extracts the statement on a specific line from an ast .