<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def infer_config_base_dir() -> Path: """ 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. """

    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]