code: def create_android_sdk_rule(environ_cp):
      """Set Android variables and write Android SDK WORKSPACE rule."""
      if is_windows() or is_cygwin():
          default_sdk_path = cygpath(
              "%s/Android/Sdk" % environ_cp["APPDATA"]
          )
      elif is_macos():
          default_sdk_path = (
              "%s/library/Android/Sdk" % environ_cp["HOME"]
          )
      else:
          default_sdk_path = "%s/Android/Sdk" % environ_cp["HOME"]
  
      def valid_sdk_path(path):
          return (
              os.path.exists(path)
              and os.path.exists(os.path.join(path, "platforms"))
              and os.path.exists(os.path.join(path, "build-tools"))
          )
  
      android_sdk_home_path = prompt_loop_or_load_from_env(
          environ_cp,
          var_name="ANDROID_SDK_HOME",
          var_default=default_sdk_path,
          ask_for_var="Please specify the home path of the Android SDK to use.",
          check_success=valid_sdk_path,
          error_msg=(
              "Either %s does not exist, or it does not contain the "
              'subdirectories "platforms" and "build-tools".'
          ),
      )
  
      platforms = os.path.join(android_sdk_home_path, "platforms")
      api_levels = sorted(os.listdir(platforms))
      api_levels = [x.replace("android-", "") for x in api_levels]
  
      def valid_api_level(api_level):
          return os.path.exists(
              os.path.join(
                  android_sdk_home_path,
                  "platforms",
                  "android-" + api_level,
              )
          )
  
      android_api_level = prompt_loop_or_load_from_env(
          environ_cp,
          var_name="ANDROID_API_LEVEL",
          var_default=api_levels[-1],
          ask_for_var=(
              "Please specify the Android SDK API level to use. "
              "[Available levels: %s]"
          )
          % api_levels,
          check_success=valid_api_level,
          error_msg="Android-%s is not present in the SDK path.",
      )
  
      build_tools = os.path.join(android_sdk_home_path, "build-tools")
      versions = sorted(os.listdir(build_tools))
  
      def valid_build_tools(version):
          return os.path.exists(
              os.path.join(
                  android_sdk_home_path, "build-tools", version
              )
          )
  
      android_build_tools_version = prompt_loop_or_load_from_env(
          environ_cp,
          var_name="ANDROID_BUILD_TOOLS_VERSION",
          var_default=versions[-1],
          ask_for_var=(
              "Please specify an Android build tools version to use. "
              "[Available versions: %s]"
          )
          % versions,
          check_success=valid_build_tools,
          error_msg="The selected SDK does not have build-tools version %s available.",
      )
  
      write_action_env_to_bazelrc(
          "ANDROID_BUILD_TOOLS_VERSION", android_build_tools_version
      )
      write_action_env_to_bazelrc(
          "ANDROID_SDK_API_LEVEL", android_api_level
      )
      write_action_env_to_bazelrc(
          "ANDROID_SDK_HOME", android_sdk_home_path
      )
  
imports: import os
  import platform
  import re
  import subprocess
  import sys
label_desc: Use image node_id 20 for calling a global function with example usage: create_android_sdk_rule(environ_cp) and returns: unknown, os, os