import ast


def copy_location(new_node, old_node):
    """An ast.copy_location extension.

    This function behaves identically to the standard ast.copy_location except
    that it also copies parent and sibling references.
    """
    new_node = ast.copy_location(new_node, old_node)
    new_node.parent = old_node.parent
    new_node.previous, new_node.next = old_node.previous, old_node.next

    return new_node