code: def lazy_sort_index(df: pd.DataFrame, axis=0) -> pd.DataFrame:
      """
      make the df index sorted
  
      df.sort_index() will take a lot of time even when `df.is_lexsorted() == True`
      This function could avoid such case
  
      Parameters
      ----------
      df : pd.DataFrame
  
      Returns
      -------
      pd.DataFrame:
          sorted dataframe
      """
      idx = df.index if axis == 0 else df.columns
      if (
          not idx.is_monotonic_increasing
          or not is_deprecated_lexsorted_pandas
          and isinstance(idx, pd.MultiIndex)
          and not idx.is_lexsorted()
      ):  # this case is for the old version
          return df.sort_index(axis=axis)
      else:
          return df
  
imports: from __future__ import division
  from __future__ import print_function
  import os
  import re
  import copy
  import json
  import yaml
  import redis
  import bisect
  import struct
  import difflib
  import inspect
  import hashlib
  import datetime
  import requests
  import collections
  import numpy
  import pandas
  from pathlib import Path
  from typing import List, Union, Optional, Callable
  from packaging import version
  from .file import get_or_create_path, save_multiple_parts_file, unpack_archive_with_buffer, get_tmp_file_with_buffer
  from ..config import C
  from ..log import get_module_logger, set_log_with_config
  from .mod import get_module_by_module_path, split_module_path, get_callable_kwargs, get_cls_kwargs, init_instance_by_config, class_casting
label_desc: Use image node_id 31 for calling a global function with example usage: lazy_sort_index(df, axis) and returns: df, df