def _get_last_child_with_lineno(node):
    ignored_fields = set(['ctx', 'decorator_list', 'names', 'returns'])
    fields = node._fields
    if isinstance(node, ast.Call):
        fields = ('func', 'args', 'starargs', 'keywords', 'kwargs')
    for name in reversed(fields):
        if name in ignored_fields:
            continue
        try:
            last_field = getattr(node, name)
        except AttributeError:
            continue
        if isinstance(last_field, ast.AST):
            return last_field
        elif isinstance(last_field, list) and last_field:
            return last_field[-1]
    return None