code: def import_seaborn():
      '''import seaborn and handle deprecation of apionly module'''
      with warnings.catch_warnings(record=True) as w:
          warnings.simplefilter("always")
          try:
              import seaborn.apionly as sns
              if (w and issubclass(w[-1].category, UserWarning) and
                      ("seaborn.apionly module" in str(w[-1].message))):
                  raise ImportError
          except ImportError:
              import seaborn as sns
          finally:
              warnings.resetwarnings()
      return snf import_seaborn():
      '''import seaborn and handle deprecation of apionly module'''
      with warnings.catch_warnings(record=True) as w:
          warnings.simplefilter("always")
          try:
              import seaborn.apionly as sns
              if (w and issubclass(w[-1].category, UserWarning) and
                      ("seaborn.apionly module" in str(w[-1].message))):
                  raise ImportError
          except ImportError:
              import seaborn as sns
          finally:
              warnings.resetwarnings()
      return sns
docs: import seaborn and handle deprecation of apionly module