def __get_best_matching_child(node, lineno):
    # This can be a one-liner with reversed
    # and next but way less readable...
    childs = getattr(node, 'body', [])
    result = next(iter(childs), None)
    result_lineno = __get_line(result)

    for child in childs[1:]:
        child_lineno = __get_line(child)

        if child_lineno > lineno:
            break
        elif child_lineno == lineno:
            return child
        elif child_lineno > result_lineno:
            result = child
            result_lineno = child_lineno

    return result
Get the best matching child of `node` for the given `lineno`.
dataset/ETHPy150Open okcompute/vim-nose/python2/code_analyzer.py/__get_best_matching_child