code: def reorder_columns(df, order_dict=None):
      """Orders columns according to ``order_dict``.
  
      Can be used to order columns according to hierarchical
      constraints. Consider the tree where a parent is the sum
      of its children. Let a node's label be its BFS traversal order,
      with the root as 0. Use ``order_dict`` to map column names
      to these node labels, to get the dataframe in BFS traversal order,
      matching the structure of the tree.
  
      Parameters
      ----------
      df : `pandas.DataFrame`
          Input data frame.
      order_dict : `dict` [`str`, `float`] or None
          How to order the columns.
          The key is the column name, the value is its position.
          Columns are returned in ascending order by value from left to right.
          Only column specified by ``order_dict`` are included in the output.
          If None, returns the original ``df``.
  
      Returns
      -------
      reordered_df : `pandas.DataFrame`
          ``df`` with the selected columns reordered.
      """
      if order_dict is not None:
          order_tuples = list(order_dict.items())
          order_tuples = sorted(order_tuples, key=lambda x: x[1])
          order_names = [x[0] for x in order_tuples]
          df = df[order_names]
      return df
  
imports: import copy
  import dataclasses
  import functools
  import math
  import re
  import warnings
  from dataclasses import field
  from typing import List
  import numpy
  import pandas
  from pandas.testing import assert_frame_equal
  from pandas.testing import assert_index_equal
  from pandas.testing import assert_series_equal
label_desc: Use image node_id 11 for calling a global function with example usage: reorder_columns(df, order_dict) and returns: df