code: def infer_config_base_dir() -> Path:
      
      if 'OT_API_CONFIG_DIR' in os.environ:
          return Path(os.environ['OT_API_CONFIG_DIR'])
      elif IS_ROBOT:
          return Path('/data')
      else:
          search = (Path.cwd(),
                    Path.home()/'.opentrons')
          for path in search:
              if (path/_CONFIG_FILENAME).exists():
                  return path
          else:
              return search[-1]
docs: Return the directory to store data in.
  
      Defaults are ~/.opentrons if not on a pi; OT_API_CONFIG_DIR is
      respected here.
  
      When this module is imported, this function is called automatically
      and the result stored in :py:attr:`APP_DATA_DIR`.
  
      This directory may not exist when the module is imported. Even if it
      does exist, it may not contain data, or may require data to be moved
      to it.
  
      :return pathlib.Path: The path to the desired root settings dir.