def set_position(cur, node, position, auto_position=True):
    """
    Set ``position`` for ``node``.

    :param node:
    :type node: Node or int
    :param int position: Position in between siblings. If 0, the node
                         will be inserted at the beginning of the
                         parents children. If -1, the node will be
                         inserted the the end of the parents children.
                         If `auto_position` is disabled, this is just a
                         value.
    :param bool auto_position: See :ref:`core-positioning`
    """
    if auto_position:
        id = int(node)
        if type(node) == int:
            node = get_node(cur, id)

        if type(position) == int and 0 >= position:
            ensure_free_position(cur, node.parent, position)
        else:
            position = find_highest_position(cur, node.parent) + 1
    else:
        id = int(node)

    sql = """
        UPDATE
          nodes
        SET
          position=%s
        WHERE
          id=%s;
    """
    cur.execute(sql, (position, int(node)))
    return position
dataset/ETHPy150Open conceptsandtraining/libtree/libtree/core/positioning.py/set_position/swapped operands of `>=`