def METHOD_NAME(exclude_symlinks=False):
    if not os.path.exists(ENVIRONMENTS_DIR):
        print("The directory {!r} does not exist.\n"
              "Set COMMCARE_CLOUD_ENVIRONMENTS to a directory that exists."
              .format(ENVIRONMENTS_DIR))
        exit(1)
    return sorted(
        env for env in os.listdir(ENVIRONMENTS_DIR)
        if os.path.exists(DefaultPaths(env).public_yml)
        and (
            os.path.exists(DefaultPaths(env).inventory_ini)
            or os.path.exists(DefaultPaths(env).inventory_csv)
            or os.path.exists(DefaultPaths(env).inventory_directory)
        )
        and not (exclude_symlinks and os.path.islink(os.path.join(ENVIRONMENTS_DIR, env)))
    )