code: def create_android_ndk_rule(environ_cp):
      """Set ANDROID_NDK_HOME and write Android NDK WORKSPACE rule."""
      if is_windows() or is_cygwin():
          default_ndk_path = cygpath(
              "%s/Android/Sdk/ndk-bundle" % environ_cp["APPDATA"]
          )
      elif is_macos():
          default_ndk_path = (
              "%s/library/Android/Sdk/ndk-bundle" % environ_cp["HOME"]
          )
      else:
          default_ndk_path = (
              "%s/Android/Sdk/ndk-bundle" % environ_cp["HOME"]
          )
  
      def valid_ndk_path(path):
          return os.path.exists(path) and os.path.exists(
              os.path.join(path, "source.properties")
          )
  
      android_ndk_home_path = prompt_loop_or_load_from_env(
          environ_cp,
          var_name="ANDROID_NDK_HOME",
          var_default=default_ndk_path,
          ask_for_var="Please specify the home path of the Android NDK to use.",
          check_success=valid_ndk_path,
          error_msg='The path %s or its child file "source.properties" does not exist.',
      )
      write_action_env_to_bazelrc(
          "ANDROID_NDK_HOME", android_ndk_home_path
      )
      write_action_env_to_bazelrc(
          "ANDROID_NDK_API_LEVEL",
          get_ndk_api_level(environ_cp, android_ndk_home_path),
      )
  
imports: import os
  import platform
  import re
  import subprocess
  import sys
label_desc: Use image node_id 19 for calling a global function with example usage: create_android_ndk_rule(environ_cp) and returns: unknown